[PATCH xserver] dix: always send focus event on grab change

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 9 23:14:59 UTC 2018


On Mon, Apr 09, 2018 at 02:35:30PM +0200, Samuel Thibault wrote:
> Focus events are useless when 'from' and 'to' are the same.  But when
> this is the result of a (Un)GrabKeyboard request, we should always send
> them, including when the window manager had previously used XSetInputFocus
> to specify the focus on a window which happens to be now taking a grab.
> 
> This is notably needed for window manager using XI to always get keyboard
> events even during grabs, so they can determine exactly when grabbing is
> active.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>

good catch, thanks.
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Ajax - feel free to take this one or wait for 1.20.1. It should be safe but
there could be subtle bugs. Proably not any worse than having this broken
for the last 10 years.

Cheers,
   Peter

> ---
>  dix/enterleave.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dix/enterleave.c b/dix/enterleave.c
> index 1b341f2de..a2f625bc9 100644
> --- a/dix/enterleave.c
> +++ b/dix/enterleave.c
> @@ -1562,7 +1562,7 @@ DoFocusEvents(DeviceIntPtr pDev, WindowPtr from, WindowPtr to, int mode)
>      if (!IsKeyboardDevice(pDev))
>          return;
>  
> -    if (from == to)
> +    if (from == to && mode != NotifyGrab && mode != NotifyUngrab)
>          return;
>  
>      CoreFocusEvents(pDev, from, to, mode);
> -- 
> 2.16.3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list