Skip to content
New issue

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

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

Already on GitHub? # to your account

Data offer source actions #372

Merged
merged 2 commits into from
Apr 5, 2023
Merged

Conversation

wash2
Copy link
Member

@wash2 wash2 commented Mar 28, 2023

While the description at https://wayland.app/protocols/wayland#wl_data_offer:event:source_actions is confusing to me, the way I read it implies that enter event should be sent before source actions for DnD offers. In practice, I've only ever seen the source actions sent before the enter event 😓.

This PR fixes the implementation so that an undetermined offer also tracks advertised source actions. When the enter event is being handled, source actions can be checked and handled as well at the same time. It doesn't call the source_actions method though, because the method expects a drag offer. It also cleans up an unused variable and makes a couple methods take &self instead of &mut self.

Ultimately I don't think this event matters so much because clients can still set their preferred action and accepted actions regardless, but the info from the source actions should be available if it is received.

@wash2 wash2 changed the title Data device actions Data device source actions Mar 28, 2023
@wash2 wash2 changed the title Data device source actions Data offer source actions Mar 28, 2023
@wash2 wash2 requested a review from i509VCB March 28, 2023 19:30
@i509VCB
Copy link
Member

i509VCB commented Mar 29, 2023

enter event should be sent before source actions for DnD offers

I am curious what other clients expected behavior is regarding that. I'd at least like to know if this is a case of the protocol being unspecified and if that is the case then report it upstream.

@wash2
Copy link
Member Author

wash2 commented Mar 29, 2023

It looks like gtk does something similar to what I'm doing here. If they haven't received the enter event they track the source actions on a pending offer in the seat, but otherwise if there is a known drop, they make the change to the drop and emit a motion event.

The change was added here.
https://gitlab.gnome.org/GNOME/gtk/-/commit/7f8a8f221d60bc5da23602e5e024eb91f8b0f758

It still looks pretty much the same.
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/wayland/gdkseat-wayland.c#L258

@wash2 wash2 merged commit 389a4f2 into Smithay:master Apr 5, 2023
@wash2 wash2 deleted the data-device-actions branch April 5, 2023 00:31
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants