[gtk+/wip/frame-synchronization] Reimplement _NET_WM_SYNC_REQUEST inside X11 backend



commit 263b5fe0338299425be0946c6e21da14ea949afb
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Dec 19 12:49:32 2012 -0500

    Reimplement _NET_WM_SYNC_REQUEST inside X11 backend
    
    Deprecate gdk_window_enable_synchronized_configure() and
    gdk_window_configure_done() and make them no-ops. Implement the
    handling of _NET_WM_SYNC_REQUEST in terms of the frame cycle -
    we know that all processing will be finished in the next frame
    cycle after the ConfigureNotify is received.

 gdk/broadway/gdkwindow-broadway.c |   16 ------
 gdk/gdkwindow.c                   |   24 ++--------
 gdk/gdkwindow.h                   |    2 +
 gdk/quartz/gdkwindow-quartz.c     |   12 -----
 gdk/wayland/gdkwindow-wayland.c   |   17 -------
 gdk/win32/gdkwindow-win32.c       |   14 ------
 gdk/x11/gdkwindow-x11.c           |   94 ++++++++++---------------------------
 gdk/x11/gdkwindow-x11.h           |    1 -
 gtk/gtkwindow.c                   |    9 ----
 9 files changed, 31 insertions(+), 158 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 08e23af..270119d 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -1515,20 +1515,6 @@ gdk_broadway_window_begin_move_drag (GdkWindow *window,
 
 }
 
-static void
-gdk_broadway_window_enable_synchronized_configure (GdkWindow *window)
-{
-  if (!GDK_IS_WINDOW_IMPL_BROADWAY (window->impl))
-    return;
-}
-
-static void
-gdk_broadway_window_configure_finished (GdkWindow *window)
-{
-  if (!WINDOW_IS_TOPLEVEL (window))
-    return;
-}
-
 static gboolean
 gdk_broadway_window_beep (GdkWindow *window)
 {
@@ -1739,8 +1725,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
   impl_class->set_functions = gdk_broadway_window_set_functions;
   impl_class->begin_resize_drag = gdk_broadway_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_broadway_window_begin_move_drag;
-  impl_class->enable_synchronized_configure = gdk_broadway_window_enable_synchronized_configure;
-  impl_class->configure_finished = gdk_broadway_window_configure_finished;
   impl_class->set_opacity = gdk_broadway_window_set_opacity;
   impl_class->set_composited = gdk_broadway_window_set_composited;
   impl_class->destroy_notify = gdk_broadway_window_destroy_notify;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 4cf3d4e..1319a2b 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -11062,44 +11062,28 @@ gdk_window_begin_move_drag (GdkWindow *window,
  * gdk_window_enable_synchronized_configure:
  * @window: a toplevel #GdkWindow
  *
- * Indicates that the application will cooperate with the window
- * system in synchronizing the window repaint with the window
- * manager during resizing operations. After an application calls
- * this function, it must call gdk_window_configure_finished() every
- * time it has finished all processing associated with a set of
- * Configure events. Toplevel GTK+ windows automatically use this
- * protocol.
- *
- * On X, calling this function makes @window participate in the
- * _NET_WM_SYNC_REQUEST window manager protocol.
+ * Does nothing, present only for compatiblity.
  *
  * Since: 2.6
+ * Deprecated: 3.8: this function is no longer needed
  **/
 void
 gdk_window_enable_synchronized_configure (GdkWindow *window)
 {
-  GDK_WINDOW_IMPL_GET_CLASS (window->impl)->enable_synchronized_configure (window);
 }
 
 /**
  * gdk_window_configure_finished:
  * @window: a toplevel #GdkWindow
- * 
- * Signal to the window system that the application has finished
- * handling Configure events it has received. Window Managers can
- * use this to better synchronize the frame repaint with the
- * application. GTK+ applications will automatically call this
- * function when appropriate.
  *
- * This function can only be called if gdk_window_enable_synchronized_configure()
- * was called previously.
+ * Does nothing, present only for compatiblity.
  *
  * Since: 2.6
+ * Deprecated: 3.8: this function is no longer needed
  **/
 void
 gdk_window_configure_finished (GdkWindow *window)
 {
-  GDK_WINDOW_IMPL_GET_CLASS (window->impl)->configure_finished (window);
 }
 
 /**
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 5626db8..ff9f0b9 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -862,7 +862,9 @@ void       gdk_window_constrain_size      (GdkGeometry  *geometry,
                                            gint         *new_width,
                                            gint         *new_height);
 
+GDK_DEPRECATED_IN_3_8
 void gdk_window_enable_synchronized_configure (GdkWindow *window);
+GDK_DEPRECATED_IN_3_8
 void gdk_window_configure_finished            (GdkWindow *window);
 
 GdkWindow *gdk_get_default_root_window (void);
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index fcfe7c1..00b00dc 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2941,16 +2941,6 @@ gdk_quartz_window_set_group (GdkWindow *window,
 }
 
 static void
-gdk_quartz_window_enable_synchronized_configure (GdkWindow *window)
-{
-}
-
-static void
-gdk_quartz_window_configure_finished (GdkWindow *window)
-{
-}
-
-static void
 gdk_quartz_window_destroy_notify (GdkWindow *window)
 {
   check_grab_destroy (window);
@@ -3067,8 +3057,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
   impl_class->set_functions = gdk_quartz_window_set_functions;
   impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag;
-  impl_class->enable_synchronized_configure = gdk_quartz_window_enable_synchronized_configure;
-  impl_class->configure_finished = gdk_quartz_window_configure_finished;
   impl_class->set_opacity = gdk_quartz_window_set_opacity;
   impl_class->destroy_notify = gdk_quartz_window_destroy_notify;
   impl_class->register_dnd = _gdk_quartz_window_register_dnd;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index fad879e..295f217 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1504,21 +1504,6 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
 }
 
 static void
-gdk_wayland_window_enable_synchronized_configure (GdkWindow *window)
-{
-}
-
-static void
-gdk_wayland_window_configure_finished (GdkWindow *window)
-{
-  if (!WINDOW_IS_TOPLEVEL (window))
-    return;
-
-  if (!GDK_IS_WINDOW_IMPL_WAYLAND (window->impl))
-    return;
-}
-
-static void
 gdk_wayland_window_set_opacity (GdkWindow *window,
 				gdouble    opacity)
 {
@@ -1700,8 +1685,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
   impl_class->set_functions = gdk_wayland_window_set_functions;
   impl_class->begin_resize_drag = gdk_wayland_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_wayland_window_begin_move_drag;
-  impl_class->enable_synchronized_configure = gdk_wayland_window_enable_synchronized_configure;
-  impl_class->configure_finished = gdk_wayland_window_configure_finished;
   impl_class->set_opacity = gdk_wayland_window_set_opacity;
   impl_class->set_composited = gdk_wayland_window_set_composited;
   impl_class->destroy_notify = gdk_wayland_window_destroy_notify;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 92b8839..1a5089d 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -3248,18 +3248,6 @@ gdk_win32_window_lookup_for_display (GdkDisplay *display,
 }
 
 static void
-gdk_win32_window_enable_synchronized_configure (GdkWindow *window)
-{
-  /* nothing - no window manager to cooperate with */
-}
-
-static void
-gdk_win32_window_configure_finished (GdkWindow *window)
-{
-  /* nothing - no window manager to cooperate with */
-}
-
-static void
 gdk_win32_window_set_opacity (GdkWindow *window,
 			gdouble    opacity)
 {
@@ -3617,8 +3605,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
 
   impl_class->begin_resize_drag = gdk_win32_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_win32_window_begin_move_drag;
-  impl_class->enable_synchronized_configure = gdk_win32_window_enable_synchronized_configure;
-  impl_class->configure_finished = gdk_win32_window_configure_finished;
   impl_class->set_opacity = gdk_win32_window_set_opacity;
   //impl_class->set_composited = gdk_win32_window_set_composited;
   impl_class->destroy_notify = gdk_win32_window_destroy_notify;
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index d284556..1ceb796 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -343,7 +343,21 @@ gdk_x11_window_begin_frame (GdkWindow *window)
 
   impl->toplevel->in_frame = TRUE;
 
-  hook_surface_changed (window);
+  if (impl->toplevel->configure_counter_value != 0 &&
+      impl->toplevel->configure_counter_value_is_extended)
+    {
+      impl->toplevel->current_counter_value = impl->toplevel->configure_counter_value;
+      if ((impl->toplevel->current_counter_value % 2) == 1)
+        impl->toplevel->current_counter_value += 1;
+
+      impl->toplevel->configure_counter_value = 0;
+
+      window_pre_damage (window);
+    }
+  else
+    {
+      hook_surface_changed (window);
+    }
 }
 
 static void
@@ -406,6 +420,16 @@ gdk_x11_window_end_frame (GdkWindow *window)
 
   unhook_surface_changed (window);
 
+  if (impl->toplevel->configure_counter_value != 0 &&
+      !impl->toplevel->configure_counter_value_is_extended)
+    {
+      set_sync_counter (GDK_WINDOW_XDISPLAY (window),
+                        impl->toplevel->update_counter,
+                        impl->toplevel->configure_counter_value);
+
+      impl->toplevel->configure_counter_value = 0;
+    }
+
   if (!impl->toplevel->frame_pending)
     gdk_frame_timings_set_complete (timings, TRUE);
 }
@@ -4961,72 +4985,6 @@ gdk_x11_window_begin_move_drag (GdkWindow *window,
     emulate_move_drag (window, device, button, root_x, root_y, timestamp);
 }
 
-static void
-gdk_x11_window_enable_synchronized_configure (GdkWindow *window)
-{
-  GdkWindowImplX11 *impl;
-
-  if (!GDK_IS_WINDOW_IMPL_X11 (window->impl))
-    return;
-  
-  impl = GDK_WINDOW_IMPL_X11 (window->impl);
-	  
-  if (!impl->use_synchronized_configure)
-    {
-      /* This basically means you want to do fancy X specific stuff, so
-	 ensure we have a native window */
-      gdk_window_ensure_native (window);
-
-      impl->use_synchronized_configure = TRUE;
-      ensure_sync_counter (window);
-    }
-}
-
-static void
-gdk_x11_window_configure_finished (GdkWindow *window)
-{
-  GdkWindowImplX11 *impl;
-
-  if (!WINDOW_IS_TOPLEVEL (window))
-    return;
-  
-  impl = GDK_WINDOW_IMPL_X11 (window->impl);
-  if (!impl->use_synchronized_configure)
-    return;
-  
-#ifdef HAVE_XSYNC
-  if (!GDK_WINDOW_DESTROYED (window))
-    {
-      GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
-      GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
-
-      if (toplevel && toplevel->update_counter != None &&
-	  GDK_X11_DISPLAY (display)->use_sync &&
-	  toplevel->configure_counter_value != 0)
-	{
-          if (toplevel->configure_counter_value_is_extended)
-            {
-              toplevel->current_counter_value = toplevel->configure_counter_value;
-              if ((toplevel->current_counter_value % 2) == 1)
-                toplevel->current_counter_value += 1;
-
-              toplevel->configure_counter_value = 0;
-
-              set_sync_counter (GDK_WINDOW_XDISPLAY (window),
-                                toplevel->extended_update_counter,
-                                toplevel->current_counter_value);
-            }
-          else
-            {
-              set_sync_counter (GDK_WINDOW_XDISPLAY (window),
-                                toplevel->update_counter,
-                                toplevel->configure_counter_value);
-            }
-        }
-    }
-#endif
-}
-
 static gboolean
 gdk_x11_window_beep (GdkWindow *window)
 {
@@ -5301,8 +5259,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
   impl_class->set_functions = gdk_x11_window_set_functions;
   impl_class->begin_resize_drag = gdk_x11_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_x11_window_begin_move_drag;
-  impl_class->enable_synchronized_configure = gdk_x11_window_enable_synchronized_configure;
-  impl_class->configure_finished = gdk_x11_window_configure_finished;
   impl_class->set_opacity = gdk_x11_window_set_opacity;
   impl_class->set_composited = gdk_x11_window_set_composited;
   impl_class->destroy_notify = gdk_x11_window_destroy_notify;
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index d58d7e3..aefc882 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -72,7 +72,6 @@ struct _GdkWindowImplX11
   guint no_bg : 1;        /* Set when the window background is temporarily
                            * unset during resizing and scaling */
   guint override_redirect : 1;
-  guint use_synchronized_configure : 1;
 
   cairo_surface_t *cairo_surface;
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 159514d..d93e0ad 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5217,7 +5217,6 @@ gtk_window_realize (GtkWidget *widget)
 
       gtk_style_context_set_background (gtk_widget_get_style_context (widget), gdk_window);
 
-      gdk_window_enable_synchronized_configure (gdk_window);
       return;
     }
 
@@ -5294,8 +5293,6 @@ gtk_window_realize (GtkWidget *widget)
   if (priv->opacity_set)
     gdk_window_set_opacity (gdk_window, priv->opacity);
 
-  gdk_window_enable_synchronized_configure (gdk_window);
-
   gdk_window_set_user_data (gdk_window, window);
 
   context = gtk_widget_get_style_context (widget);
@@ -5636,7 +5633,6 @@ gtk_window_configure_event (GtkWidget         *widget,
       if (GTK_WIDGET_CLASS (gtk_window_parent_class)->configure_event)
   	return GTK_WIDGET_CLASS (gtk_window_parent_class)->configure_event (widget, event);
 
-      gdk_window_configure_finished (gtk_widget_get_window (widget));
       return FALSE;
     }
 
@@ -5670,7 +5666,6 @@ gtk_window_configure_event (GtkWidget         *widget,
       (allocation.width == event->width &&
        allocation.height == event->height))
     {
-      gdk_window_configure_finished (gtk_widget_get_window (widget));
       return TRUE;
     }
 
@@ -7266,10 +7261,6 @@ gtk_window_move_resize (GtkWindow *window)
       set_grip_position (window);
       update_grip_visibility (window);
 
-      gdk_window_process_updates (gdk_window, TRUE);
-
-      gdk_window_configure_finished (gdk_window);
-
       /* If the configure request changed, it means that
        * we either:
        *   1) coincidentally changed hints or widget properties



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