After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772914 - wayland: Only suspend pointer grabs while compositor grab is active
wayland: Only suspend pointer grabs while compositor grab is active
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-10-14 06:14 UTC by Jonas Ådahl
Modified: 2016-10-19 09:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland/pointer: Don't set focus while during compositor grab (1.43 KB, patch)
2016-10-14 06:14 UTC, Jonas Ådahl
committed Details | Review
wayland: Don't cancel the pointer grab on compositor grabs (1.77 KB, patch)
2016-10-14 06:14 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2016-10-14 06:14:29 UTC
We can't cancel the grab when a compositor grab is activated (i.e. alt-tab, overview etc) because it will make things like drag -> alt-tab -> drop impossible. Before this patch, we'd end up with a drag operation state thinking its active, but with a pointer grab being reset to the default grab, potentially causing issues when the drag grab is eventually cleaned up.

Note that thera are still issues with cross-compositor-grab drag-n-drop operations, such as the feedback actor not being updated since the pointer grab isn't receiving any pointer motions. This will eventually be addressed by the future ClutterGrab mechanism.
Comment 1 Jonas Ådahl 2016-10-14 06:14:33 UTC
Created attachment 337684 [details] [review]
wayland/pointer: Don't set focus while during compositor grab

Teach the default grab about compositor grabs (i.e.
display->event_route) so that it can avoid setting a pointer focus when
after the compositor grab actively unset the pointer focus.
Comment 2 Jonas Ådahl 2016-10-14 06:14:38 UTC
Created attachment 337685 [details] [review]
wayland: Don't cancel the pointer grab on compositor grabs

We shouldn't cancel the pointer grab when there is a compositor grab,
since that'd break things like drag-n-drop via the overview and
alt-tabs.

The original reason for cancelling the pointer grab on compositor grabs
was to avoid a re-entry when a compositor grab was activated while
there was an active pointer constraint grab. The re-entry would happen
when the compositor grab cleared the pointer focus. Clearing the focus
would trigger the pointer constraint to be deactivated, which would end
its grab. Ending the grab would reset the grab to the default one, which
could focus the same surface again, triggering the constraint to
re-enable before it finished disabling.

This is now avoided because the default grab handler is now aware of
compositor grabs, and won't override the cleared pointer focus until
the compositor grab ends.
Comment 3 Rui Matos 2016-10-17 14:07:52 UTC
Review of attachment 337684 [details] [review]:

looks good. commit message is a bit confusing with things like "while during" and "when after"
Comment 4 Rui Matos 2016-10-17 14:10:26 UTC
Review of attachment 337685 [details] [review]:

makes sense, and I can now dnd through the overview but I can also release the mouse button while on the overview and the dnd doesn't get canceled
Comment 5 Jonas Ådahl 2016-10-18 10:22:54 UTC
(In reply to Rui Matos from comment #4)
> Review of attachment 337685 [details] [review] [review]:
> 
> makes sense, and I can now dnd through the overview but I can also release
> the mouse button while on the overview and the dnd doesn't get canceled

True. I don't think that's a regression from before though. The problem is that as long as there is any composito grab, the dnd grab doesn't get any input, so it won't see the button release. Until we have something like ClutterGrab, the best thing we could o is to add a hack that checks the button count on every grab-focus vfunc call to see whether it should cancel when it would start receiving input events again.
Comment 6 Jonas Ådahl 2016-10-19 08:49:54 UTC
Pushed since this improves stability and the reported issue is not a regression.

Attachment 337684 [details] pushed as b50da46 - wayland/pointer: Don't set focus while during compositor grab
Attachment 337685 [details] pushed as 8a7876d - wayland: Don't cancel the pointer grab on compositor grabs
Comment 7 Jonas Ådahl 2016-10-19 09:28:15 UTC
(In reply to Rui Matos from comment #3)
> Review of attachment 337684 [details] [review] [review]:
> 
> looks good. commit message is a bit confusing with things like "while
> during" and "when after"

Sorry, noticed I didn't fix the commit message, so it ended up in the git history.