Add alive() method for grabs, and add PopupTouchGrab#1911
Add alive() method for grabs, and add PopupTouchGrab#1911ids1024 wants to merge 10 commits intoSmithay:masterfrom
alive() method for grabs, and add PopupTouchGrab#1911Conversation
54701ec to
90fee55
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1911 +/- ##
==========================================
- Coverage 18.73% 18.30% -0.44%
==========================================
Files 182 182
Lines 28934 29342 +408
==========================================
- Hits 5421 5370 -51
- Misses 23513 23972 +459
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I guess we need an MSRV of 1.88 to use |
This is called whenever the grab is used, and if it returns `false`, the keyboard/pointer/touch will be treated as not grabbed, and the grab will be removed automatically. The actual removal of the grab only happens in `*Internal`/`*Inner::with_grab`, since `unset()` requires a `data: &mut D` argument. This function may be called somewhat frequently, but that's probably fine as long as the implementation is nothing too complicated. An alternative would be to not check everywhere and instead do so in some periodic refresh, but this seems reasonable.
alive() method for grabs, and PopupTouchGrab
|
Okay, I think this is working now. Previously, running two copies of Not sure if we should change anything else related to that, but having a touch grab prevents that. Now either the grab is removed, or touch input, like other input, can't go to the other process. I've added a new |
|
Oh, and I forgot that I meant to use This may warrant a bit more testing, but assuming no unforseen issues, it's a nice cleanup to the popup grab code. |
c931f80 to
574e7f2
Compare
|
I guess to change how popup grabs work, there are more details to get the behavior right. Though on cosmic-comp (on the existing version), I see |
f242802 to
fc065c7
Compare
alive() method for grabs, and PopupTouchGrabalive() method for grabs, and add PopupTouchGrab
|
Well now that issue is fixed too, but closing a menu by touching elsewhere on the window is making the window not open again... |
|
I guess not having a |
This replaces `unset_keyboard_grab` with a single mechanism to make sure that any of the three grabs (keyboard, pointer, touch) ending results in all of them being removed. It also makes it unnecesary to check `has_ended()` in various methods. If the method is called, `alive()` has already been checked. We could do this a different way, like using `with_grab` on each type of input device, downcasting, and checking if it's a matching popup grab, but this `alive()` mechanism seems cleaner.
This ensures the popup is dismissed when the grab is removed somewhere other than the `button()` method here. For instance, pressing `esc` on cosmic-comp.
Needs testing.
https://wayland.app/protocols/xdg-shell#xdg_popup:request:grab says popups that take a grab should also take touch input.