[gtk+/wip/frame-synchronization: 21/33] gdk_display_get_event: don't unqueue events from the windowing system when paused



commit 465221da786576dce50cf1e00e42f20a3847b268
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Oct 7 11:47:49 2012 -0400

    gdk_display_get_event: don't unqueue events from the windowing system when paused
    
    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 paint 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         |    8 ++++----
 gdk/x11/gdkeventsource.c |   12 +++++++++---
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 31b0282..94cf584 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -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);
 }
 
 /**
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index 6b82611..4b1a546 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]