GNOME Bugzilla – Bug 771305
wayland: Make it (maybe) possible to create popup grabs with only touch again
Last modified: 2016-09-15 02:32:52 UTC
It seems for some reason we could create popup grabs with touch devices even when there were no pointer devices on the device. Possibly it could also have been because pointer devices are classified differently now, thus not enabling the pointer device class when it was before. Either way, a system without a pointer could popup popups before, but can't now, and this is an attempt to fix that.
Created attachment 335368 [details] [review] wayland/seat: Add API to check whether a seat has a device class Meant to replace explicitly checking whether a MetaWaylandPointer/MetaWaylandKeyboard/MetaWaylandTouch has a seat or not to determine whether they are supposed to be active or not.
Created attachment 335369 [details] [review] wayland: Add common object for device classes Add a new object class, MetaWaylandInputDevice, and make all device classes (pointer, keyboard, touch) inherit it. In the future common functionality may be placed there.
Created attachment 335370 [details] [review] wayland: Move device seat association to MetaWaylandInputDevice Make the device <-> seat association permanent, and move it into MetaWaylandInputDevice. A device will never be disassociated with a seat, so there is no point in unsetting it.
Created attachment 335371 [details] [review] MetaWaylandPointer: Initialize default grab on init Instead of initializing the default grab when the device class is enabled, initialize it on object initialization. This way other device classes can still grab the pointer, as if there was one. This may be useful for example if a touch grab is active and a mouse is connected. This also makes it possible for popup grabs, which currently use a pointer grab for controlling, to be triggered by touch devices, while still holding an active pointer grab.
Created attachment 335417 [details] [review] wayland: Add common object for device classes Add a new object class, MetaWaylandInputDevice, and make all device classes (pointer, keyboard, touch) inherit it. In the future common functionality may be placed there.
Comment on attachment 335368 [details] [review] wayland/seat: Add API to check whether a seat has a device class Much better than foo->seat != NULL :)
Comment on attachment 335417 [details] [review] wayland: Add common object for device classes Makes sense, perhaps the enable/disable functions are good first candidates for MetaWaylandInputDevice vmethods.
Comment on attachment 335370 [details] [review] wayland: Move device seat association to MetaWaylandInputDevice Looks good. Nice simplification of the relationship semantics.
Comment on attachment 335371 [details] [review] MetaWaylandPointer: Initialize default grab on init Makes sense for the time being. I should work again on compositor grabs...
FWIW, I tried the patches and fix the crash here.
Comment on attachment 335370 [details] [review] wayland: Move device seat association to MetaWaylandInputDevice Btw, in this one probably we should add #include "meta-wayland-input-device.h" in all of meta-wayland-pointer/keyboard/touch.h, I had local compile errors because G_DECLARE_FINAL_TYPE there doesn't find MetaWaylandInputDeviceClass. Adding MetaWaylandInputDeviceClass to meta-wayland-types.h should also work I guess.
It's included in meta-wayland-seat.h (as are the other (keyboard/touch/..). It was fixed in the patch uploaded last (replaced the broken one).
Attachment 335368 [details] pushed as d2cdbd4 - wayland/seat: Add API to check whether a seat has a device class Attachment 335370 [details] pushed as 87f82d9 - wayland: Move device seat association to MetaWaylandInputDevice Attachment 335371 [details] pushed as 98f0578 - MetaWaylandPointer: Initialize default grab on init Attachment 335417 [details] pushed as a6646b3 - wayland: Add common object for device classes