Skip to content

More fixes around set_grab/unset_grab#1391

Merged
Drakulix merged 3 commits into
Smithay:masterfrom
ids1024:grab
Apr 16, 2024
Merged

More fixes around set_grab/unset_grab#1391
Drakulix merged 3 commits into
Smithay:masterfrom
ids1024:grab

Conversation

@ids1024
Copy link
Copy Markdown
Member

@ids1024 ids1024 commented Apr 15, 2024

This is a followup to #1386, which I noticed an issue with: cancelled drags in clients like Firefox and Nautilus caused the window to act like it didn't have pointer focus until it lost and regained it. It seems the the previous change in KeyboardGrab also wasn't quite right.

See commit messages for more specific details.

This is a breaking API change requiring passing additional arguments, but although a bit annoying to update for, it's pretty straightforward.

ids1024 added 3 commits April 15, 2024 14:35
It's easy enough to change the type generic to use this in all three
places, so we might as well.
This was already supposed to happen, but I hadn't noticed that these
functions don't delegate to a method of the innter handle, like they do
with touch.

This is a breaking API change, since these functions then need to take
`&mut D`. But this seems reasonable since the equivalents for
pointer/touch already require that, and `&mut D` should be available to
call wherever these are used.
This fixes an issue I noticed where cancelled drag-and-drop in clients
like Firefox and Nautilus caused a window to ignore pointer events until
losing and regaining focus. It seems calling the `.ungrab` method at the
end of `with_grab` means calling it after pointer focus is restored, and
clients seem not to handle the `wl_pointer.enter` before the drag is
actually over.

Deferring the focus restoration as well is slightly complicated to
implement, and seems problematic when it involves a serial. Maybe there
shouldn't be any input events after the `*set_grab` call but before
returning, but this seems cleaner.

Taking a reference to the handler in `*InterHandle.*set_grab` is a bit
annoying, but easy enough to deal with, and allows this to work more
cleanly. This seems reasonable as long as we don't have a better
solution to the whole `GrabStatus::Borrowed` thing.
Copy link
Copy Markdown
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible to me.

@Drakulix Drakulix merged commit eea0d9c into Smithay:master Apr 16, 2024
ids1024 added a commit to pop-os/cosmic-comp that referenced this pull request Apr 16, 2024
Updates for changes in Smithay/smithay#1391.
Drakulix pushed a commit to pop-os/cosmic-comp that referenced this pull request Apr 17, 2024
Updates for changes in Smithay/smithay#1391.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants