]> Pileus Git - ~andy/gtk/commitdiff
gdk_display_get_event: don't unqueue events from the windowing system when paused
authorOwen W. Taylor <otaylor@fishsoup.net>
Sun, 7 Oct 2012 15:47:49 +0000 (11:47 -0400)
committerOwen W. Taylor <otaylor@fishsoup.net>
Thu, 14 Feb 2013 22:19:50 +0000 (17:19 -0500)
Unqueuing events from the windowing system when paused could result
in weird reordering if event filters resulted in application-visible
behavior. Since we now resume events when the frame clock is frozen,
we now no longer count on low-level event handling running while
event handling is paused.

https://bugzilla.gnome.org/show_bug.cgi?id=685460

gdk/gdkdisplay.c
gdk/x11/gdkeventsource.c

index 8e5092c4d9d587b64d3f708fb3b18fac2ad97d02..bded54aecb131eb171f4975a0815750ce8c1367b 100644 (file)
@@ -307,12 +307,12 @@ gdk_display_get_event (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
-  GDK_DISPLAY_GET_CLASS (display)->queue_events (display);
-
   if (display->events_paused)
     return NULL;
-  else
-    return _gdk_event_unqueue (display);
+
+  GDK_DISPLAY_GET_CLASS (display)->queue_events (display);
+
+  return _gdk_event_unqueue (display);
 }
 
 /**
index 6b82611bfccbb539e9b3e304c4d1b74590e4a07d..4b1a5469459e78868e9a2a39ef5fcf3098309a07 100644 (file)
@@ -276,8 +276,12 @@ gdk_event_source_prepare (GSource *source,
   gdk_threads_enter ();
 
   *timeout = -1;
-  retval = (_gdk_event_queue_find_first (display) != NULL ||
-            gdk_check_xpending (display));
+
+  if (display->event_pause_count > 0)
+    retval = FALSE;
+  else
+    retval = (_gdk_event_queue_find_first (display) != NULL ||
+              gdk_check_xpending (display));
 
   gdk_threads_leave ();
 
@@ -292,7 +296,9 @@ gdk_event_source_check (GSource *source)
 
   gdk_threads_enter ();
 
-  if (event_source->event_poll_fd.revents & G_IO_IN)
+  if (event_source->display->event_pause_count > 0)
+    retval = FALSE;
+  else if (event_source->event_poll_fd.revents & G_IO_IN)
     retval = (_gdk_event_queue_find_first (event_source->display) != NULL ||
               gdk_check_xpending (event_source->display));
   else