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_source.cancelled not sent when dropping outside any surface #3932

Closed
yorickvP opened this issue Mar 18, 2019 · 13 comments · Fixed by #5200
Closed

wl_data_source.cancelled not sent when dropping outside any surface #3932

yorickvP opened this issue Mar 18, 2019 · 13 comments · Fixed by #5200
Labels
bug Not working as intended

Comments

@yorickvP
Copy link
Contributor

  • Sway Version: 1.0

  • Reproduction Steps:

  1. start weston-dnd, make it floating
  2. drag to outside of weston-dnd and release mouse
@emersion
Copy link
Member

emersion commented Apr 9, 2020

WAYLAND_DEBUG log: https://gist.github.com/nickdiego/5becea1a865a96d56a3b14ca1381c39e

Last event is motion:

[1923619.502] wl_data_device@17.motion(5662254, 40.882812, 239.566406)

It should be cancelled instead.

@emersion emersion added the bug Not working as intended label Apr 9, 2020
@emersion emersion changed the title drag&drop to desktop breaks drag&drop until restart wl_data_source.cancelled not sent when dropping outside any surface Apr 9, 2020
@Emantor
Copy link
Contributor

Emantor commented Apr 9, 2020

Don't the following two lines indicate that the offer was accepted?

[1923619.502] wl_data_device@17.motion(5662254, 40.882812, 239.566406)
[1923620.367]  -> wl_data_offer@4278190081.set_actions(7, 2)
[1923620.441]  -> wl_data_offer@4278190081.accept(6400, "text/plain")

@emersion
Copy link
Member

emersion commented Apr 9, 2020

accept is used for feedback during drag-and-drop. See https://emersion.fr/blog/2020/wayland-clipboard-drag-and-drop/

@emersion
Copy link
Member

emersion commented Apr 9, 2020

Eh, you're right, my bad.

@emersion
Copy link
Member

emersion commented Apr 9, 2020

Eh, no, sorry - accept is indeed used for feedback, but that's legacy so not mentioned in my article.

@nickdiego
Copy link
Contributor

nickdiego commented Apr 9, 2020

Additionally, I've noticed some misbehavior regarding enter/leave events. It seems like the client just receives the leave event once the pointer enters another surface (perhaps some tiling-mode assumption is being made at server side?).

@Emantor
Copy link
Contributor

Emantor commented Apr 10, 2020

Looks like wlr_seat_pointer_notify_button is never called when the pointer is outside of a surface.

Emantor added a commit to Emantor/sway that referenced this issue Apr 10, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace.

Fixes swaywm#3932
Emantor added a commit to Emantor/sway that referenced this issue Apr 10, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace.

Fixes swaywm#3932
Emantor added a commit to Emantor/sway that referenced this issue Apr 10, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace.

Fixes swaywm#3932
@nickdiego
Copy link
Contributor

Looks like wlr_seat_pointer_notify_button is never called when the pointer is outside of a surface.

@Emantor Does this also fix the issue I describe in the comment above ? Or maybe I should file a separate issue for it?

Anyways, thanks for looking into it.

@Emantor
Copy link
Contributor

Emantor commented Apr 10, 2020

Looks like wlr_seat_pointer_notify_button is never called when the pointer is outside of a surface.

@Emantor Does this also fix the issue I describe in the comment above ? Or maybe I should file a separate issue for it?

Not sure, haven't looked into it yet. Would be nice if you could test #5200.

@nickdiego
Copy link
Contributor

Just gave it a try. This is what I observed:

  1. Dragging a file out of nautilus into the desktop shell seems to finish the dnd session, but not sure if it does internally everything expected by clients. I mean, the "fly back" effect in the drag icon that happens on Gnome Shell, for example, does not show up on Sway. Here is the debug log for this case.

  2. When one drags a file out of its original Nautilus window, enters a second nautilus window (activating it = focus_follows_mouse yes), and then goes back over the desk shell and releases the mouse button there, the file is "moved" to the last focused window. Here's the debug log. Not sure if this is a app bug in surface activation / data_device enter events, etc.

Let me know if you need further info.
Thanks.

@emersion
Copy link
Member

I mean, the "fly back" effect in the drag icon that happens on Gnome Shell, for example, does not show up on Sway

I think this effect is performed by GNOME Shell itself.

Not sure if this is a app bug in surface activation / data_device enter events, etc.

Maybe we don't send leave in this case?

@nickdiego
Copy link
Contributor

Additionally, I've noticed some misbehavior regarding enter/leave events. It seems like the client just receives the leave event once the pointer enters another surface (perhaps some tiling-mode assumption is being made at server side?).

@emersion Oh, that just reminded me this ^
Indeed, maybe there's something else that needed to be fixed in dnd events handling.

Emantor added a commit to Emantor/sway that referenced this issue Apr 14, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace. This is achieved by removing the early
return and letting the handle_button() call seat_pointer_notify_button()
at the very end.

Fixes swaywm#3932
Emantor added a commit to Emantor/sway that referenced this issue Apr 15, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace. This is achieved by removing the early
return and letting the handle_button() call seat_pointer_notify_button()
at the very end.

Fixes swaywm#3932
emersion pushed a commit that referenced this issue Apr 15, 2020
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace. This is achieved by removing the early
return and letting the handle_button() call seat_pointer_notify_button()
at the very end.

Fixes #3932
@nickdiego
Copy link
Contributor

Thanks for fixing this.

Just opened #5220 to track the aforementioned wl_data_device::leave events issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

Successfully merging a pull request may close this issue.

4 participants