From 888e5f636a32945b0a1f59d6db6e143d094cc2a0 Mon Sep 17 00:00:00 2001 From: Andrew Comminos Date: Tue, 29 Dec 2015 23:41:27 -0800 Subject: [PATCH] Input: Send XI2 FocusOut NotifyPointer events to the pointer window. This changes XInput 2's propagation of NotifyPointer focus out events to include the pointer window as well, similar to core events. This fixes a potential permanent focus in GDK when the focus moves to PointerRoot. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93539 Signed-off-by: Andrew Comminos Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer (cherry picked from commit 2fbf5c2f91d33efbda573c4be036248b1d8ed7f1) --- dix/enterleave.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dix/enterleave.c b/dix/enterleave.c index f0b1572fb..1b341f2de 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -1446,19 +1446,25 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) if ((to == NullWindow) || (to == PointerRootWin)) { if ((from == NullWindow) || (from == PointerRootWin)) { - if (from == PointerRootWin) + if (from == PointerRootWin) { + DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, + sprite->win); DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode, NotifyPointer); + } /* Notify all the roots */ for (i = 0; i < nscreens; i++) DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); } else { - if (IsParent(from, sprite->win)) + if (IsParent(from, sprite->win)) { + DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, + sprite->win); DeviceFocusOutEvents(dev, sprite->win, from, mode, NotifyPointer); + } DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from); /* next call catches the root too, if the screen changed */ DeviceFocusOutEvents(dev, from, NullWindow, mode, @@ -1476,10 +1482,13 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) } else { if ((from == NullWindow) || (from == PointerRootWin)) { - if (from == PointerRootWin) + if (from == PointerRootWin) { + DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, + sprite->win); DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode, NotifyPointer); + } for (i = 0; i < nscreens; i++) DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); @@ -1506,9 +1515,12 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) if ((IsParent(from, sprite->win)) && (sprite->win != from) && (!IsParent(to, sprite->win)) && - (!IsParent(sprite->win, to))) + (!IsParent(sprite->win, to))) { + DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, + sprite->win); DeviceFocusOutEvents(dev, sprite->win, from, mode, NotifyPointer); + } DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyInferior, from); DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);