[gtk+/wip/frame-synchronization: 834/857] GdkDisplay: handle multiple calls to _gdk_display_pause_events()
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/frame-synchronization: 834/857] GdkDisplay: handle multiple calls to _gdk_display_pause_events()
- Date: Wed, 13 Feb 2013 06:13:38 +0000 (UTC)
commit fb3facb0b2be11866c6254ee132429e163fc0941
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Sun Oct 7 14:13:56 2012 -0400
GdkDisplay: handle multiple calls to _gdk_display_pause_events()
Since events can be paused independently for each window during processing,
make _gdk_display_pause_events() count how many times it is called
and only unpause when unpause_events() is called the same number of
times.
https://bugzilla.gnome.org/show_bug.cgi?id=685460
gdk/gdkdisplay.c | 15 +++++++++++----
gdk/gdkdisplayprivate.h | 7 ++++---
gdk/gdkevents.c | 2 +-
gdk/gdkwindow.c | 4 ++--
4 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index bded54a..79d162b 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -307,7 +307,7 @@ gdk_display_get_event (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- if (display->events_paused)
+ if (display->event_pause_count > 0)
return NULL;
GDK_DISPLAY_GET_CLASS (display)->queue_events (display);
@@ -2008,10 +2008,17 @@ gdk_display_notify_startup_complete (GdkDisplay *display,
}
void
-_gdk_display_set_events_paused (GdkDisplay *display,
- gboolean events_paused)
+_gdk_display_pause_events (GdkDisplay *display)
{
- display->events_paused = !!events_paused;
+ display->event_pause_count++;
+}
+
+void
+_gdk_display_unpause_events (GdkDisplay *display)
+{
+ g_return_if_fail (display->event_pause_count > 0);
+
+ display->event_pause_count--;
}
void
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 8f448eb..b4559eb 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -113,8 +113,9 @@ struct _GdkDisplay
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
+ guint event_pause_count; /* How many times events are blocked */
+
guint closed : 1; /* Whether this display has been closed */
- guint events_paused : 1; /* Whether events are blocked */
guint flushing_events : 1; /* Inside gdk_display_flush_events */
GArray *touch_implicit_grabs;
@@ -298,8 +299,8 @@ void _gdk_display_pointer_info_foreach (GdkDisplay *display
GdkDisplayPointerInfoForeach func,
gpointer user_data);
gulong _gdk_display_get_next_serial (GdkDisplay *display);
-void _gdk_display_set_events_paused (GdkDisplay *display,
- gboolean events_paused);
+void _gdk_display_pause_events (GdkDisplay *display);
+void _gdk_display_unpause_events (GdkDisplay *display);
void _gdk_display_flush_events (GdkDisplay *display);
void _gdk_display_event_data_copy (GdkDisplay *display,
const GdkEvent *event,
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index d068e13..8e05a8e 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -88,7 +88,7 @@ _gdk_event_queue_find_first (GdkDisplay *display)
GList *tmp_list;
GList *pending_motion = NULL;
- if (display->events_paused)
+ if (display->event_pause_count > 0)
return NULL;
tmp_list = display->queued_events;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 0ac0cfe..211f8fd 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -11620,7 +11620,7 @@ gdk_window_flush_events (GdkFrameClock *clock,
display = gdk_window_get_display (window);
_gdk_display_flush_events (display);
- _gdk_display_set_events_paused (display, TRUE);
+ _gdk_display_pause_events (display);
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS);
}
@@ -11648,7 +11648,7 @@ gdk_window_resume_events (GdkFrameClock *clock,
window = GDK_WINDOW (data);
display = gdk_window_get_display (window);
- _gdk_display_set_events_paused (display, FALSE);
+ _gdk_display_unpause_events (display);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]