-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add Pointer/Touch/KeyboardHandle::with_grab() and downcasting #1567
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the main goal is to just be able check if a certain grab is active it might just make sense to add something like has_grab<T>(&self) -> bool
?
I figured I might as well just add the full function if a use case turns up later on. |
Not sure there is a use-case where you would need access to the (Just some idea, I am also fine with accessing the dyn Trait) |
Well, with dyn Trait you can check if a grab is active and if it's a particular grab type in one go more or less. |
Lets the compositor inspect the active grab and its serial.
Lets the compositor figure out which particular grab is active.
Lets the compositor check for click vs. dnd vs. other grabs.
Same deal, lets the compositor inspect the grab should it need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me
Allows the compositor to inspect which grab is currently active.
Use case 1: in niri I want to scroll the workspace left and right when hovering the mouse close to output edges with a DnD grab, but not with a regular click grab.
Use case 2: avoiding a weird case with libadwaita DnD/move conflict https://gitlab.gnome.org/GNOME/gtk/-/issues/7113 by checking if the active grab is a DnD grab specifically and denying the move request in that case.
Debug impls are auto-generated with rust-analyzer (they want
D: 'static
).