NotifyGrab

Samuel Thibault samuel.thibault at ens-lyon.org
Mon Apr 9 12:39:04 UTC 2018


Hello,

I have kept the story below for the record and attached the testcase
again in case it could be useful.

So the issue is that DoFocusEvents does not send focus events if
from == to, which happens here because the focus-grab.c is calling
XSetInputFocus to set the input focus (as expected for a window manager)
and it happens that it's that window which is requesting a grab, so from
== to. But since it is a grab, we should really emit the focus event, so
that listeners (notably XI listeners) are aware of the grabbing taking
place.  I have posted a patch fixing it titled "dix: always send focus
event on grab change" on xorg-devel at lists.x.org for review.

Cheers,
Samuel

Samuel Thibault, le ven. 22 déc. 2017 01:01:04 +0100, a ecrit:
> Samuel Thibault, on jeu. 21 déc. 2017 18:21:39 +0100, wrote:
> > Samuel Thibault, on jeu. 21 déc. 2017 17:50:54 +0100, wrote:
> > > One additionnal piece of information: it seems that what makes compiz
> > > have the issue (compared to my simple X root event listener) is the call
> > > to
> > > 
> > > XSetInputFocus (s->dpy (), priv->id, RevertToPointerRoot, CurrentTime);
> > > 
> > > on the window that after that acquires the grab.
> > 
> > Here are reproducers.
> > 
> > - First run focus-grab on a bare X server
> > - then run grab, which opens a window on the top left corner.
> > - Move the mouse to it.
> >   -> in focus-grab the enter notify handler calls XSetInputFocus [*]
> > - press the g key  
> > 
> > The result is this: On the ./grab side:
> > 
> > focus out 4194305 0
> > focus in 4194305 0
> > 0: ||
> > 1: |g|
> > 0:1|g|
> > res 0
> > 
> > I.e. it got the 'g' keypress event, and successfully called XGrabKeyboard.
> > And on the ./focus-grab side:
> > 
> > started
> > create 4194305
> > enter 4194305 0
> > 1
> > core focus out 4194305 0
> > core focus out 38 0
> > core focus out 38 0
> > core focus in 38 0
> > core focus in 4194305 0
> > focus out 6 0
> > key press 7 7 42 0
> > key release 7 7 42 0
> > 
> > I.e. it saw the creation of the window, catched entering the window
> > and set XSetInputFocus, which generate focus events, then saw the 'g'
> > keypress (77 is my numlock) but didn't see any grab-related focus
> > events. That's my concern.
> 
> And without the XSetInputFocus call, one gets
> 
> 1: |g|
> 0:1|g|
> res 0
> focus out 4194305 1
> focus in 4194305 1
> 
> and
> 
> started
> create 4194305
> enter 4194305 0
> key press 7 7 42 0
> core focus out 4194305 1
> core focus out 38 1
> core focus out 38 1
> core focus in 38 1
> core focus in 4194305 1
> focus out 6 1
> key release 7 7 42 0
> 
> i.e. there really is the grab information.
> 
> BTW, this is X server core 1.19.5 (Debian Buster up to date)
> 
> Samuel

-- 
Samuel
> 	dvips -o $@ $<     
Faut faire gffe de pas te couper avec ton truc, t'as mis des ciseaux ($<)
partout :))
-+- Dom in Guide du linuxien pervers - "J'aime pas les Makefile !" -+-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grab.c
Type: text/x-csrc
Size: 2388 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180409/a48e145b/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: focus-grab.c
Type: text/x-csrc
Size: 4147 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180409/a48e145b/attachment-0001.c>


More information about the xorg-devel mailing list