From: Owen W. Taylor Date: Wed, 20 Feb 2013 17:27:07 +0000 (-0500) Subject: Broadway/Quartz/Win32: make event source prepare()/check() note paused status X-Git-Url: http://pileus.org/git/?p=~andy%2Fgtk;a=commitdiff_plain;h=df3e19b449815911acb73ead93a0063a9cfeb3bb Broadway/Quartz/Win32: make event source prepare()/check() note paused status When events are paused, we should not return TRUE from prepare() or check(). GTK+ handles this for events that are already in the GTK+ queue, but we also need suppress checks for events that are in the system queue - if we return TRUE indicating that there are events in the system queue, then we'll call dispatch(), and do nothing. The event source will spin, and will never run the other phases of the paint clock. (Broadway doesn't have a window system queue separate from the GDK event queue, but we write the function the same way for consistency.) https://bugzilla.gnome.org/show_bug.cgi?id=694274 --- diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c index e9aa2c86b..a4399c431 100644 --- a/gdk/broadway/gdkeventsource.c +++ b/gdk/broadway/gdkeventsource.c @@ -61,7 +61,11 @@ gdk_event_source_prepare (GSource *source, gdk_threads_enter (); *timeout = -1; - retval = (_gdk_event_queue_find_first (display) != NULL); + + if (display->event_pause_count > 0) + retval = FALSE; + else + retval = (_gdk_event_queue_find_first (display) != NULL); gdk_threads_leave (); @@ -76,7 +80,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); else retval = FALSE; diff --git a/gdk/quartz/gdkeventloop-quartz.c b/gdk/quartz/gdkeventloop-quartz.c index 479cd72a7..6691744f2 100644 --- a/gdk/quartz/gdkeventloop-quartz.c +++ b/gdk/quartz/gdkeventloop-quartz.c @@ -620,8 +620,11 @@ gdk_event_prepare (GSource *source, *timeout = -1; - retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || - _gdk_quartz_event_loop_check_pending ()); + if (display->event_pause_count > 0) + retval = FALSE; + else + retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || + _gdk_quartz_event_loop_check_pending ()); gdk_threads_leave (); @@ -635,8 +638,11 @@ gdk_event_check (GSource *source) gdk_threads_enter (); - retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || - _gdk_quartz_event_loop_check_pending ()); + if (display->event_pause_count > 0) + retval = FALSE; + else + retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || + _gdk_quartz_event_loop_check_pending ()); gdk_threads_leave (); diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 962daf2d0..7866f3177 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -3330,9 +3330,12 @@ gdk_event_prepare (GSource *source, *timeout = -1; - retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || - (modal_win32_dialog == NULL && - GetQueueStatus (QS_ALLINPUT) != 0)); + if (display->event_pause_count > 0) + retval = FALSE; + else + retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || + (modal_win32_dialog == NULL && + GetQueueStatus (QS_ALLINPUT) != 0)); gdk_threads_leave (); @@ -3346,16 +3349,14 @@ gdk_event_check (GSource *source) gdk_threads_enter (); - if (event_poll_fd.revents & G_IO_IN) - { - retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || - (modal_win32_dialog == NULL && - GetQueueStatus (QS_ALLINPUT) != 0)); - } + if (display->event_pause_count > 0) + retval = FALSE; + else if (event_poll_fd.revents & G_IO_IN) + retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || + (modal_win32_dialog == NULL && + GetQueueStatus (QS_ALLINPUT) != 0)); else - { - retval = FALSE; - } + retval = FALSE; gdk_threads_leave ();