Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl_data_device.leave events are not sent #5220

Closed
nickdiego opened this issue Apr 15, 2020 · 1 comment · Fixed by #5222 or swaywm/wlroots#2217
Closed

wl_data_device.leave events are not sent #5220

nickdiego opened this issue Apr 15, 2020 · 1 comment · Fixed by #5222 or swaywm/wlroots#2217
Labels
bug Not working as intended input/pointer

Comments

@nickdiego
Copy link
Contributor

nickdiego commented Apr 15, 2020

Steps to repro:

  • Open 2 nautilus windows and put them in floating mode
  • From window 1, start dragging a file until the pointer enters the window 2;
  • Drag it out of window 2 into desktop shell (outside any toplevel surface) and drop the file;

Expected result:

  • The dnd is canceled and keeps the dragged file on the window 1's folder

Actual result:

  • The file is moved to window 2's folder

From the debug logs, it seems like wl_data_device::leave events are not sent when the pointer actually leaves the surface, instead they are sent when it enters another surface.

It's also reproducible in tiling mode, for example, when the drag enters a 2nd surface and then leaves to a 2nd screen (with no surface) and drop the file there.

Version:

➜  ~ swaymsg -t get_version                                                                                     
sway version 1.4-0efc28e2f58a (Apr 15 2020, branch 'master')

This already includes fix for #3932 .

@nickdiego
Copy link
Contributor Author

Screen cast illustrating it: https://cloud.igalia.com/s/qFfgekFf5SKSjZe

@emersion emersion added the bug Not working as intended label Apr 15, 2020
nickdiego added a commit to nickdiego/sway that referenced this issue Apr 16, 2020
Currently, clients receive wl_data_device::leave events only when the
pointer enters another surface, which leads to issues, such as swaywm#5220.
This happens because wlr_seat_pointer_notify_enter() is called when
handling motion events only for non-NULL surfaces.

Fixes swaywm#5220
nickdiego added a commit to nickdiego/sway that referenced this issue Apr 24, 2020
Currently, clients receive wl_data_device::leave events only when the
pointer enters another surface, which leads to issues, such as swaywm#5220.
This happens because wlr_seat_pointer_notify_enter() is called when
handling motion events only for non-NULL surfaces.

Fixes swaywm#5220
emersion pushed a commit that referenced this issue May 1, 2020
Currently, clients receive wl_data_device::leave events only when the
pointer enters another surface, which leads to issues, such as #5220.
This happens because wlr_seat_pointer_notify_enter() is called when
handling motion events only for non-NULL surfaces.

Fixes #5220
tchebb added a commit to tchebb/sway that referenced this issue May 21, 2020
We are not allowed to do what we did in swaywm#5222 and pass a `NULL` surface
wlr_seat_pointer_notify_enter(), and it's causing crashes when an
xdg-shell popup is active (see swaywm#5294 and swaywm/wlroots#2161).

Instead, solve swaywm#5220 using the new wlroots API introduced in
swaywm/wlroots#2217.
emersion pushed a commit to swaywm/wlroots that referenced this issue Jun 5, 2020
This is necessary for some grabs, which currently have no way of knowing
when the pointer/keyboard focus has left a surface. For example, without
this, a drag-and-drop grab can erroneously drop into a window that the
cursor is no longer over.

This is the plumbing needed to properly fix swaywm/sway#5220. The
existing fix, swaywm/sway#5222, relies on every grab's `enter()` hook
allowing a `NULL` surface. This is not guaranteed by the API and, in
fact, is not the case for the xdg-shell popup grab and results in a
crash when the cursor leaves a surface and does not immediately enter
another one while a popup is open (#2161).

This fix also adds an assertion to wlr_seat_pointer_notify_enter() that
ensures it's never called with a `NULL` surface. This will make Sway
crash much more until it fixes its usage of the API, so we should land
this at the same time as a fix in Sway (which I haven't posted yet).
emersion pushed a commit that referenced this issue Jun 5, 2020
We are not allowed to do what we did in #5222 and pass a `NULL` surface
wlr_seat_pointer_notify_enter(), and it's causing crashes when an
xdg-shell popup is active (see #5294 and swaywm/wlroots#2161).

Instead, solve #5220 using the new wlroots API introduced in
swaywm/wlroots#2217.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended input/pointer
3 participants