XI_Enter/XI_Leave coming from a slave

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 15 07:53:35 UTC 2018


On Tue, Jan 09, 2018 at 07:18:31PM -0500, David Bokan wrote:
> Hello,
> 
> Please bear with me as I'm utterly new to X - I'm trying to debug an issue
> in Chromium when using xtest. I'm not sure if the bug is in Chromium, X, or
> XTest or some combination of the three.
> 
> There's two things that are puzzling me:
> 
> 1) When I click mouse button 1 on a physical device, it seems that there's
> some kind of grab going on: I get an XI_Enter event with NotifyGrab and an
> XI_Leave with NotifyUngrab. This kind of makes sense except that I've
> disabled the explicit device grab (XIGrabDevice) and we don't have any
> passive grabs that I can see. So where is this grab coming from? If I press
> down and move the pointer out of the window I continue to see motion events.

it's part of the core protocol functionality, whenever a button event is
delivered to a client it activates and implicit passive grab for that
button. google/grep for "implicit passive grab", you should find a few
things.
 
> I tried to make a simple app to repro but couldn't. Using XIGrabButton
> doesn't cause XI_Enter/Leave events if the click is with in the window.
> So...where could this behavior be coming from? Figuring out how to
> reproduce this would help me debug the issue below.
> 
> 2) This is the real issue I'm debugging. Given the above XI_Enter/Leave
> behavior on mouse buttons, It seems that using xtest causes us to get an
> extra pair of XI_Enter and XI_Leave events on a mouse down with deviceid ==
> 4 (xtest pointer) - in addition to the regular ones we get as described
> above for the master pointer.
> 
> I can kind of repro this in a test app by using XIGrabButton on deviceid=4.
> This causes me to get the crossing events with deviceid=4 but I don't get a
> second pair for the master pointer.

I'd have to page all the details into my brain again, but IIRC grabbing a
slave device detaches it from the master device for the duration of the
grab. so for that time being, the event sequence is a bit different. It
shouldn't be different for xtest devices, the grab code doesn't care about
whether it's an xtest device or some other device.
 
> Any idea what might be happening or advice on how to dig deeper? Anything I
> could try (e.g. is there a way to clear all passive grabs?)

you can break grabs forcibly with the xkb 'grab:break_actions' action which
I think is then mapped to ctrl+alt+keypad /. That's a debugging feature
though, not something from the client.

Cheers,
   Peter


More information about the xorg mailing list