grab mouse wheel with XI2
peter.hutterer at who-t.net
Wed Nov 6 23:52:48 UTC 2019
On Sat, Nov 02, 2019 at 07:23:18PM +0100, Jonathan Michalon wrote:
> Using compiz it is possible to assign shortcuts to various actions.
> When such a shortcut is activated, it has to be blocked and not
> dispatched to the underlying applications. This works well for keyboard
> and button 1 to 3 with grabs. But for mouse wheel (button 4,5) it seems
> to have no effect.
> We think to have found the issue: with XI2, scroll is now reported as a
> special kind of motion, and only emulated as button clicks for legacy
> clients. This means that the XGrabButton() call will not prevent
> XI2-aware clients from receiving scroll events. We need to somehow grab
> XI_Motion events associated with scrolling.
> Example in GTK3 for the code in GTK3 generating "smooth scroll" events:
> I'm not yet sure how to grab those, but I'm leaning towards
> XIGrabDevice(), although it seems a little too aggressive on some
> aspects, for example we do not want to block completely the desktop if
> something goes wrong in compiz itself and pointer is grabbed.
Grabbing a device doesn't block the desktop (like e.g. XGrabServer does) but
it does block anyone else from getting events from this device.
Unfortunately that is your only option, not being able to grab the mouse
wheel events was an unfortunate and unintended side-effect of the smooth
> Is this the only way to go? Is there some better way? No X.org guru on
> our side so maybe we miss something obvious… better ask here for
> some informations before doing this badly.
> (BTW I'm no compiz dev, but willing to submit a patch there and also
> I'm not subscribed to the list.)
> Thanks in advance!
More information about the xorg