Blame SOURCES/0001-events-Don-t-use-XIEvent-serial-numbers.patch

2c033f
From b21bd3f820e875aa67b8f8dcb7b648eaebb7d926 Mon Sep 17 00:00:00 2001
2c033f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
2c033f
Date: Thu, 9 Jul 2015 17:39:05 +0200
2c033f
Subject: [PATCH] events: Don't use XIEvent serial numbers
2c033f
2c033f
XInput2 uses the raw sequence number for XIEvent serials, which only
2c033f
matches the serial number in XEvents up to 16 bits[0]. So in order to
2c033f
be able to make reliable comparisons with serials from other events or
2c033f
calls to XNextRequest(), always use the field from the original XEvent
2c033f
rather than the XIEvent serial.
2c033f
2c033f
[0] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/XlibInt.c#n265
2c033f
---
2c033f
 src/x11/events.c | 20 +++++++++++---------
2c033f
 1 file changed, 11 insertions(+), 9 deletions(-)
2c033f
2c033f
diff --git a/src/x11/events.c b/src/x11/events.c
2c033f
index bf2dd9b..fbfd2dd 100644
2c033f
--- a/src/x11/events.c
2c033f
+++ b/src/x11/events.c
2c033f
@@ -691,7 +691,8 @@ meta_spew_event_print (MetaDisplay *display,
2c033f
 static gboolean
2c033f
 handle_window_focus_event (MetaDisplay  *display,
2c033f
                            MetaWindow   *window,
2c033f
-                           XIEnterEvent *event)
2c033f
+                           XIEnterEvent *event,
2c033f
+                           unsigned long serial)
2c033f
 {
2c033f
   MetaWindow *focus_window;
2c033f
 #ifdef WITH_VERBOSE_MODE
2c033f
@@ -726,7 +727,7 @@ handle_window_focus_event (MetaDisplay  *display,
2c033f
               event->event, window_type,
2c033f
               meta_event_mode_to_string (event->mode),
2c033f
               meta_event_detail_to_string (event->mode),
2c033f
-              event->serial);
2c033f
+              serial);
2c033f
 #endif
2c033f
 
2c033f
   /* FIXME our pointer tracking is broken; see how
2c033f
@@ -770,7 +771,7 @@ handle_window_focus_event (MetaDisplay  *display,
2c033f
   if (event->evtype == XI_FocusIn)
2c033f
     {
2c033f
       display->server_focus_window = event->event;
2c033f
-      display->server_focus_serial = event->serial;
2c033f
+      display->server_focus_serial = serial;
2c033f
       focus_window = window;
2c033f
     }
2c033f
   else if (event->evtype == XI_FocusOut)
2c033f
@@ -784,7 +785,7 @@ handle_window_focus_event (MetaDisplay  *display,
2c033f
         }
2c033f
 
2c033f
       display->server_focus_window = None;
2c033f
-      display->server_focus_serial = event->serial;
2c033f
+      display->server_focus_serial = serial;
2c033f
       focus_window = NULL;
2c033f
     }
2c033f
   else
2c033f
@@ -834,8 +835,9 @@ crossing_serial_is_ignored (MetaDisplay  *display,
2c033f
 }
2c033f
 
2c033f
 static gboolean
2c033f
-handle_input_xevent (MetaDisplay *display,
2c033f
-                     XIEvent     *input_event)
2c033f
+handle_input_xevent (MetaDisplay  *display,
2c033f
+                     XIEvent      *input_event,
2c033f
+                     unsigned long serial)
2c033f
 {
2c033f
   XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
2c033f
   Window modified;
2c033f
@@ -872,7 +874,7 @@ handle_input_xevent (MetaDisplay *display,
2c033f
       /* Check if we've entered a window; do this even if window->has_focus to
2c033f
        * avoid races.
2c033f
        */
2c033f
-      if (window && !crossing_serial_is_ignored (display, input_event->serial) &&
2c033f
+      if (window && !crossing_serial_is_ignored (display, serial) &&
2c033f
           enter_event->mode != XINotifyGrab &&
2c033f
           enter_event->mode != XINotifyUngrab &&
2c033f
           enter_event->detail != XINotifyInferior &&
2c033f
@@ -897,7 +899,7 @@ handle_input_xevent (MetaDisplay *display,
2c033f
       break;
2c033f
     case XI_FocusIn:
2c033f
     case XI_FocusOut:
2c033f
-      if (handle_window_focus_event (display, window, enter_event) &&
2c033f
+      if (handle_window_focus_event (display, window, enter_event, serial) &&
2c033f
           enter_event->event == enter_event->root)
2c033f
         {
2c033f
           if (enter_event->evtype == XI_FocusIn &&
2c033f
@@ -1741,7 +1743,7 @@ meta_display_handle_xevent (MetaDisplay *display,
2c033f
     }
2c033f
 #endif /* HAVE_XI23 */
2c033f
 
2c033f
-  if (handle_input_xevent (display, input_event))
2c033f
+  if (handle_input_xevent (display, input_event, event->xany.serial))
2c033f
     {
2c033f
       bypass_gtk = bypass_compositor = TRUE;
2c033f
       goto out;
2c033f
-- 
2c033f
2.4.3
2c033f