[gtk+/gdk-backend-wayland: 2/10] Dont iterate the display if there's nothing to write



commit e6c1f5d94d33b6356b572d45fbf1084d4bc85746
Author: Kristian Høgsberg <krh bitplanet net>
Date:   Thu Jan 6 15:22:36 2011 -0500

    Dont iterate the display if there's nothing to write

 gdk/wayland/gdkdisplay-wayland.c |    4 ++--
 gdk/wayland/gdkeventsource.c     |   10 ++++++++++
 gdk/wayland/gdkprivate-wayland.h |    1 +
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 378fbea..86a36f0 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -490,8 +490,8 @@ gdk_wayland_display_flush (GdkDisplay *display)
   g_return_if_fail (GDK_IS_DISPLAY (display));
 
   if (!display->closed)
-    wl_display_iterate(GDK_DISPLAY_WAYLAND (display)->wl_display,
-		       WL_DISPLAY_WRITABLE);
+    _gdk_wayland_display_flush (display,
+				GDK_DISPLAY_WAYLAND (display)->event_source);
 }
 
 static gboolean
diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c
index 12c9118..553cc35 100644
--- a/gdk/wayland/gdkeventsource.c
+++ b/gdk/wayland/gdkeventsource.c
@@ -151,6 +151,16 @@ _gdk_wayland_display_event_source_new (GdkDisplay *display)
 }
 
 void
+_gdk_wayland_display_flush (GdkDisplay *display, GSource *source)
+{
+  GdkWaylandEventSource *wayland_source = (GdkWaylandEventSource *) source;
+
+  while (wayland_source->mask & WL_DISPLAY_WRITABLE)
+    wl_display_iterate(GDK_DISPLAY_WAYLAND (display)->wl_display,
+		       WL_DISPLAY_WRITABLE);
+}
+
+void
 _gdk_wayland_display_queue_events (GdkDisplay *display)
 {
   GdkDisplayWayland *display_wayland;
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index fa3b278..ef13fea 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -121,6 +121,7 @@ GdkDeviceManager *_gdk_device_manager_new (GdkDisplay *display);
 void     _gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event);
 GSource *_gdk_wayland_display_event_source_new (GdkDisplay *display);
 void     _gdk_wayland_display_queue_events (GdkDisplay *display);
+void     _gdk_wayland_display_flush (GdkDisplay *display, GSource *source);
 
 GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *display);
 



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