[gtk+] GdkWindowX11: Prevent non renderered window to be display by the compositor



commit e62a6dfdbcfe3e7bf951fb131d7c1813b38e1038
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Thu Jun 13 16:36:56 2013 +0100

    GdkWindowX11: Prevent non renderered window to be display by the compositor
    
    When mapping a window for the first time, make sure the compositor
    won't display it until we're done painting.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702196

 gdk/x11/gdkwindow-x11.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index a5c4507..fd6fbdf 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -325,7 +325,8 @@ gdk_x11_window_predict_presentation_time (GdkWindow *window)
 }
 
 static void
-gdk_x11_window_begin_frame (GdkWindow *window)
+gdk_x11_window_begin_frame (GdkWindow *window,
+                            gboolean   force_frame)
 {
   GdkWindowImplX11 *impl;
 
@@ -350,6 +351,13 @@ gdk_x11_window_begin_frame (GdkWindow *window)
 
       window_pre_damage (window);
     }
+  else if (force_frame)
+    {
+      /* When mapping the window, we really want to freeze the
+         rendering of the window by the compositor until we've
+         actually painted something into the window's buffer. */
+      window_pre_damage (window);
+    }
   else
     {
       hook_surface_changed (window);
@@ -945,7 +953,7 @@ setup_toplevel_window (GdkWindow *window,
   ensure_sync_counter (window);
 
   /* Start off in a frozen state - we'll finish this when we first paint */
-  gdk_x11_window_begin_frame (window);
+  gdk_x11_window_begin_frame (window, TRUE);
 }
 
 static void
@@ -953,7 +961,7 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
                              GdkWindow     *window)
 {
   gdk_x11_window_predict_presentation_time (window);
-  gdk_x11_window_begin_frame (window);
+  gdk_x11_window_begin_frame (window, FALSE);
 }
 
 static void


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