Bug 405267

Summary: Impossible to abort dragging from Dolphin to desktop by pressing ESC on Wayland while cursor is over desktop
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: Desktop ContainmentAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: alex765, andrea.ippo, claudius.ellsel, ddascalescu+kde, dev+kde, herzenschein, katyaberezyaka, kde, kde, magiblot, mauromol, nate, plasma-bugs, postix
Priority: NOR Keywords: wayland
Version: 5.20.90   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.25

Description Patrick Silva 2019-03-09 14:50:13 UTC
STEPS TO REPRODUCE
1. start Wayland session
2. drag some file/folder to desktop
3. press ESC while you are dragging the icon

OBSERVED RESULT
Dragging operation is not aborted

EXPECTED RESULT
Dragging operation is aborted like on X11

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.15.2
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.1
Comment 1 Patrick Silva 2019-07-01 15:17:24 UTC
correcting step 3:
3. press ESC while you are dragging the icon and you are hovering the desktop

Operating System: Arch Linux 
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13.0
Comment 2 magiblot 2020-06-03 20:34:07 UTC
This could be a Kwin bug: https://gitlab.com/kwinft/kwinft/-/issues/45
But I don't know if it has been reported in mainline Kwin.
Comment 3 Thiago Sueto 2020-08-29 14:12:26 UTC
I can consistently reproduce this on current Plasma from master branch.
Comment 4 Claudius Ellsel 2020-09-10 17:38:27 UTC
I experience the same. Aborting with ESC works for me when the mouse is inside the dolphin window again. Just not when it is outside.
Comment 5 Dan Dascalescu 2021-03-01 09:32:48 UTC
Still seeing this issue with KDE neon 5.21.1.
Comment 6 Nate Graham 2021-03-04 19:40:11 UTC
Can confirm. Seems like the desktop needs to handle the escape key too.
Comment 7 David Redondo 2021-10-07 07:19:30 UTC
Theory without looking at code, the panel does not do keyboard focus so we can't escape?
Comment 8 Andrea Ippolito 2022-01-22 14:58:07 UTC
Can confirm on latest tumbleweed (KDE 5.23.5 IIRC)
Comment 9 Marco Martin 2022-03-02 11:58:22 UTC
esc to cancel works only internally in the client, doesn't between any two arbitrary clients, regardless the  toolkit
looking on what gnome does, cancel on esc seems to be managed on mutter side, in meta-wayland-data-device.c

static gboolean
keyboard_drag_grab_key (MetaWaylandKeyboardGrab *grab,
                        const ClutterEvent      *event)
{
if (event->key.keyval == CLUTTER_KEY_Escape)
    {
    MetaWaylandDragGrab *drag_grab;

    drag_grab = wl_container_of (grab, drag_grab, keyboard_grab);
    meta_wayland_data_source_cancel (drag_grab->drag_data_source);
    meta_wayland_data_source_set_current_offer (drag_grab->drag_data_source, NULL);
    meta_dnd_actor_drag_finish (META_DND_ACTOR (drag_grab->feedback_actor), FALSE);
    drag_grab->feedback_actor = NULL;
    data_device_end_drag_grab (drag_grab);

    return TRUE;
    }

return FALSE;
}


I think we should do it server side as well in kwin
Comment 10 Bug Janitor Service 2022-03-02 13:44:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-server/-/merge_requests/356
Comment 11 Bug Janitor Service 2022-03-02 13:47:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2083
Comment 12 Marco Martin 2022-03-03 09:09:33 UTC
Git commit 7c09b4637c9ef9d4e326443a41edd2216de438a4 by Marco Martin.
Committed on 03/03/2022 at 09:09.
Pushed by mart into branch 'master'.

Add a methood to fore cancel any drag in progress

This is needed to cancel drags by pressing Escape which is
resposibility of the compositor

M  +17   -9    src/server/seat_interface.cpp
M  +5    -0    src/server/seat_interface.h
M  +2    -2    src/server/seat_interface_p.h

https://invent.kde.org/plasma/kwayland-server/commit/7c09b4637c9ef9d4e326443a41edd2216de438a4
Comment 13 Marco Martin 2022-03-03 09:54:23 UTC
Git commit e00d83670847c19c7f92e13b2bb1ef18ae093964 by Marco Martin.
Committed on 03/03/2022 at 09:54.
Pushed by mart into branch 'master'.

Force cancel of any drag in progress when Escape is pressed

when escape is pressed when dragging between different clients,
cancelling any drag is compositor's responsibility

M  +16   -0    src/input.cpp

https://invent.kde.org/plasma/kwin/commit/e00d83670847c19c7f92e13b2bb1ef18ae093964
Comment 14 Patrick Silva 2022-03-11 13:18:32 UTC
This bug persists. Drag-and-rop is completed instead of aborted when I press ESC key. And now I can reproduce even on X11.



Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 15 Nate Graham 2022-03-11 17:07:51 UTC
Cannot reproduce that with current git master. It could be a separate thing. Could you file a new bug report for it?
Comment 16 Patrick Silva 2022-05-18 13:04:37 UTC
(In reply to Nate Graham from comment #15)
> Cannot reproduce that with current git master. It could be a separate thing.
> Could you file a new bug report for it?

reported as bug 453981
Comment 17 Andrea Ippolito 2022-05-18 15:57:02 UTC
In my case Esc only cancels the drag and drop operation if pressed after the mouse button has been released: as long as the button is pressed, Esc presses are ignored (I am pressing Esc repeatedly in this screen recording while the little green "+" icon is shown:

https://photos.app.goo.gl/iWgFTKRoC6vX6J7F6