XI_Enter/XI_Leave coming from a slave
David Bokan
bokan at chromium.org
Tue Jan 23 23:43:21 UTC 2018
On Mon, Jan 15, 2018 at 2:53 AM, Peter Hutterer <peter.hutterer at who-t.net>
wrote:
> 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.
>
Thanks, that makes sense and I can reproduce the implicit grab but it still
doesn't explain the EnterNotify/XI_Enter (chromium is listening for both)
events I'm seeing after a button press. That is, the pointer is already
inside the window but on ButtonPress I get a EnterNotify+XI_Enter events. I
can't find that explained in any documentation and I can't replicate this
behavior in a stripped down repro. xtrace shows this on a button press:
000:>:0705: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x0d time=0x2c5c3858 detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x000d
000:>:0705: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x02 time=0x2c5c3858 detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x000d
000:>:0705: Event EnterNotify(7) detail=Inferior(0x02) mode=Grab(0x01)
flags=focus,same-screen time=0x2c5c3858 root=0x0000012d event=0x05600001
child=None(0x00000000) state=Button1
000:>:0705: Event Generic(35) XInputExtension(131) Enter(7) deviceid=0x02
time=0x2c5c3858 sourceid=0x02 mode=Grab(0x01) detail=Inferior(0x02)
root=0x0000012d event=0x05600001 child=0x00000000 same_screen=true(0x01)
focus=true(0x01) masks=0x00000002;
>
> > 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.
>
This might be a red herring, Chromium always does the XIGrabDevice on the
master pointer. I've also removed the XIGrabDevice and the issue still
remains. The difference in behavior comes down to the XTest slave causing
an XI_Enter (without a matching EnterNotify) for the slave deviceid. Real
devices don't. Here's the xtrace comparing the two:
XTest:
000:>:0662: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x04 time=0x2c28195d detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x0004
___This is sent only for XTest___ 000:>:0662: Event Generic(35)
XInputExtension(131) Enter(7) deviceid=0x04 time=0x2c28195d sourceid=0x04
mode=Grab(0x01) detail=Inferior(0x02) root=0x0000012d event=0x05600001
child=0x00000000 same_screen=true(0x01) focus=true(0x01) masks=0x00000002;
000:>:0662: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x02 time=0x2c28195d detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x0004
000:>:0662: Event EnterNotify(7) detail=Inferior(0x02) mode=Grab(0x01)
flags=focus,same-screen time=0x2c28195d root=0x0000012d event=0x05600001
child=None(0x00000000) state=Button1
000:>:0662: Event Generic(35) XInputExtension(131) Enter(7) deviceid=0x02
time=0x2c28195d sourceid=0x02 mode=Grab(0x01) detail=Inferior(0x02)
root=0x0000012d event=0x05600001 child=0x00000000 same_screen=true(0x01)
focus=true(0x01) masks=0x00000002;
Real Device:
000:>:0eca: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x0d time=0x2c6a733b detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x000d
000:>:0eca: Event Generic(35) XInputExtension(131) ButtonPress(4)
deviceid=0x02 time=0x2c6a733b detail=0x00000001 root=0x0000012d
event=0x05600001 child=0x0560000e sourceid=0x000d
000:>:0eca: Event EnterNotify(7) detail=Inferior(0x02) mode=Grab(0x01)
flags=focus,same-screen time=0x2c6a733b root=0x0000012d event=0x05600001
child=None(0x00000000) state=Button1
000:>:0eca: Event Generic(35) XInputExtension(131) Enter(7) deviceid=0x02
time=0x2c6a733b sourceid=0x02 mode=Grab(0x01) detail=Inferior(0x02)
root=0x0000012d event=0x05600001 child=0x00000000 same_screen=true(0x01)
focus=true(0x01) masks=0x00000002;
There's nothing specific to XTest in Chromium but it also seems unlikely to
me to be special in X. Any ideas would be appreciated.
> 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
>
Thanks for the help,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20180123/2f0a00b2/attachment-0001.html>
More information about the xorg
mailing list