[gtk+/gdk-backend: 39/91] Add vfuncs for process_updates_recurse and the before and after hooks



commit c6cb0099db832893d21f9f03d8592f85dda6d357
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 13 13:30:05 2010 -0500

    Add vfuncs for process_updates_recurse and the before and after hooks

 gdk/gdkdisplayprivate.h  |    3 ++
 gdk/gdkwindow.c          |   54 ++++++++++++++++++++++++++++++++-------------
 gdk/gdkwindowimpl.h      |    3 ++
 gdk/x11/gdkdisplay-x11.c |    3 ++
 gdk/x11/gdkprivate-x11.h |    2 +
 gdk/x11/gdkwindow-x11.c  |   12 +++++-----
 6 files changed, 55 insertions(+), 22 deletions(-)
---
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index d47144c..9b1f12b 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -170,6 +170,9 @@ struct _GdkDisplayClass
                                                         GdkDragProtocol *protocol,
                                                         guint           *version);
 
+  void                       (*before_process_all_updates) (GdkDisplay *display);
+  void                       (*after_process_all_updates)  (GdkDisplay *display);
+
   /* Signals */
   void (*closed) (GdkDisplay *display,
                   gboolean    is_error);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 0345a2c..c62f057 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4010,19 +4010,18 @@ gdk_window_process_updates_internal (GdkWindow *window)
 	  cairo_region_get_extents (update_area, &clip_box);
 	  end_implicit = gdk_window_begin_implicit_paint (window, &clip_box);
 	  expose_region = cairo_region_copy (update_area);
+	  impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
 	  if (!end_implicit)
 	    {
 	      /* Rendering is not double buffered by gdk, do outstanding
 	       * moves and queue antiexposure immediately. No need to do
 	       * any tricks */
 	      gdk_window_flush_outstanding_moves (window);
-	      impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
 	      save_region = impl_class->queue_antiexpose (window, update_area);
 	    }
-
 	  /* Render the invalid areas to the implicit paint, by sending exposes.
 	   * May flush if non-double buffered widget draw. */
-	  _gdk_windowing_window_process_updates_recurse (window, expose_region);
+          impl_class->process_updates_recurse (window, expose_region);
 
 	  if (end_implicit)
 	    {
@@ -4031,17 +4030,12 @@ gdk_window_process_updates_internal (GdkWindow *window)
 
 	      /* By this time we know that any outstanding expose for this
 	       * area is invalid and we can avoid it, so queue an antiexpose.
-	       * However, it may be that due to an non-double buffered expose
 	       * we have already started drawing to the window, so it would
 	       * be to late to anti-expose now. Since this is merely an
 	       * optimization we just avoid doing it at all in that case.
 	       */
-	      if (window->implicit_paint != NULL &&
-		  !window->implicit_paint->flushed)
-		{
-		  impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
-		  save_region = impl_class->queue_antiexpose (window, update_area);
-		}
+	      if (window->implicit_paint != NULL && !window->implicit_paint->flushed)
+                save_region = impl_class->queue_antiexpose (window, update_area);
 
 	      gdk_window_end_implicit_paint (window);
 	    }
@@ -4064,11 +4058,39 @@ gdk_window_process_updates_internal (GdkWindow *window)
 static void
 flush_all_displays (void)
 {
-  GSList *displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
-  GSList *tmp_list;
+  GSList *displays, *l;
+
+  displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+  for (l = displays; l; l = l->next)
+    gdk_display_flush (l->data);
+
+  g_slist_free (displays);
+}
+
+static void
+before_process_all_updates (void)
+{
+  GSList *displays, *l;
+  GdkDisplayClass *display_class;
+
+  displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+  display_class = GDK_DISPLAY_GET_CLASS (displays->data);
+  for (l = displays; l; l = l->next)
+    display_class->before_process_all_updates (l->data);
+
+  g_slist_free (displays);
+}
+
+static void
+after_process_all_updates (void)
+{
+  GSList *displays, *l;
+  GdkDisplayClass *display_class;
 
-  for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
-    gdk_display_flush (tmp_list->data);
+  displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+  display_class = GDK_DISPLAY_GET_CLASS (displays->data);
+  for (l = displays; l; l = l->next)
+    display_class->after_process_all_updates (l->data);
 
   g_slist_free (displays);
 }
@@ -4116,7 +4138,7 @@ gdk_window_process_all_updates (void)
   update_windows = NULL;
   update_idle = 0;
 
-  _gdk_windowing_before_process_all_updates ();
+  before_process_all_updates ();
 
   g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
 
@@ -4141,7 +4163,7 @@ gdk_window_process_all_updates (void)
 
   flush_all_displays ();
 
-  _gdk_windowing_after_process_all_updates ();
+  after_process_all_updates ();
 
   in_process_all_updates = FALSE;
 
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index 00ecedd..fe50b7a 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -251,6 +251,9 @@ struct _GdkWindowImplClass
   GdkDragContext * (*drag_begin)        (GdkWindow *window,
                                          GdkDevice *device,
                                          GList     *targets);
+
+  void         (*process_updates_recurse) (GdkWindow      *window,
+                                           cairo_region_t *region);
 };
 
 /* Interface Functions */
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index dc79096..f905540 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -2703,5 +2703,8 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
   display_class->get_maximal_cursor_size = _gdk_x11_display_get_maximal_cursor_size;
   display_class->supports_cursor_alpha = _gdk_x11_display_supports_cursor_alpha;
   display_class->supports_cursor_color = _gdk_x11_display_supports_cursor_color;
+
+  display_class->before_process_all_updates = _gdk_x11_display_before_process_all_updates;
+  display_class->after_process_all_updates = _gdk_x11_display_after_process_all_updates;
 }
 
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 0d2a0cc..50302c2 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -173,6 +173,8 @@ void       _gdk_x11_display_get_default_cursor_size (GdkDisplay *display,
 void       _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
                                                      guint      *width,
                                                      guint      *height);
+void       _gdk_x11_display_before_process_all_updates (GdkDisplay *display);
+void       _gdk_x11_display_after_process_all_updates  (GdkDisplay *display);
 
 void _gdk_x11_precache_atoms (GdkDisplay          *display,
 			      const gchar * const *atom_names,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 527da43..72170e9 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -4862,20 +4862,20 @@ gdk_x11_window_set_composited (GdkWindow *window,
 #endif
 }
 
-void
-_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
-                                               cairo_region_t *region)
+static void
+gdk_x11_window_process_updates_recurse (GdkWindow      *window,
+                                        cairo_region_t *region)
 {
   _gdk_window_process_updates_recurse (window, region);
 }
 
 void
-_gdk_windowing_before_process_all_updates (void)
+_gdk_x11_display_before_process_all_updates (GdkDisplay *display)
 {
 }
 
 void
-_gdk_windowing_after_process_all_updates (void)
+_gdk_x11_display_after_process_all_updates (GdkDisplay *display)
 {
 }
 
@@ -5051,5 +5051,5 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
   impl_class->destroy_notify = gdk_x11_window_destroy_notify;
   impl_class->register_dnd = _gdk_x11_window_register_dnd;
   impl_class->drag_begin = _gdk_x11_window_drag_begin;
+  impl_class->process_updates_recurse = gdk_x11_window_process_updates_recurse;
 }
-



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