[PATCH] dix: Set focus field on XI2 crossing events

Carlos Garnacho carlosg at gnome.org
Wed Feb 6 05:07:22 PST 2013


From: Carlos Garnacho <carlosg at gnome.org>

Set on DeviceEnterLeaveEvent() the xXIEnterEvent->focus field
similarly to how the CoreEnterLeaveEvent() function above does
for core events.

This fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=677329
reported to GTK+, where focus handling on window managers with
sloppy focus or no window manager present was broken due to this
field being always set to FALSE.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 dix/events.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dix/events.c b/dix/events.c
index f72cdc7..2682ecd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4569,6 +4569,7 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
 {
     GrabPtr grab = mouse->deviceGrab.grab;
     xXIEnterEvent *event;
+    WindowPtr focus;
     int filter;
     int btlen, len, i;
     DeviceIntPtr kbd;
@@ -4610,6 +4611,11 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
         event->group.locked_group = kbd->key->xkbInfo->state.locked_group;
     }
 
+    focus = (kbd) ? kbd->focus->win : None;
+    if ((focus != NoneWin) &&
+        ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin)))
+        event->focus = TRUE;
+
     FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin,
                          None, FALSE);
 
-- 
1.8.1



More information about the xorg-devel mailing list