[mutter] compositor: map overlay window before redirecting windows



commit e15bc372255ac0954b22218a38427dde34c23118
Author: Ray Strode <rstrode redhat com>
Date:   Fri Mar 1 14:41:11 2013 -0500

    compositor: map overlay window before redirecting windows
    
    When windows get redirected off screen, all that gets left behind
    is black. We don't want to flicker black at startup, though.
    
    This commit maps the overlay window early, before redirecting
    toplevels, so they end up getting snapshotted onto the background
    pixmap of the overlay window when the overlay window is mapped.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694321

 src/compositor/compositor.c |   47 ++++++++++++++++++++++++++++--------------
 1 files changed, 31 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index c5021eb..20cbde4 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -464,23 +464,16 @@ after_stage_paint (gpointer data)
   return TRUE;
 }
 
-void
-meta_compositor_manage_screen (MetaCompositor *compositor,
-                               MetaScreen     *screen)
+static void
+redirect_windows (MetaCompositor *compositor,
+                  MetaScreen     *screen)
 {
-  MetaCompScreen *info;
-  MetaDisplay    *display       = meta_screen_get_display (screen);
-  Display        *xdisplay      = meta_display_get_xdisplay (display);
-  int             screen_number = meta_screen_get_screen_number (screen);
-  Window          xroot         = meta_screen_get_xroot (screen);
-  Window          xwin;
-  gint            width, height;
-  guint           n_retries;
-  guint           max_retries;
-
-  /* Check if the screen is already managed */
-  if (meta_screen_get_compositor_data (screen))
-    return;
+  MetaDisplay *display       = meta_screen_get_display (screen);
+  Display     *xdisplay      = meta_display_get_xdisplay (display);
+  Window       xroot         = meta_screen_get_xroot (screen);
+  int          screen_number = meta_screen_get_screen_number (screen);
+  guint        n_retries;
+  guint        max_retries;
 
   if (meta_get_replace_current_wm ())
     max_retries = 5;
@@ -513,6 +506,21 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
       n_retries++;
       g_usleep (G_USEC_PER_SEC);
     }
+}
+
+void
+meta_compositor_manage_screen (MetaCompositor *compositor,
+                               MetaScreen     *screen)
+{
+  MetaCompScreen *info;
+  MetaDisplay    *display       = meta_screen_get_display (screen);
+  Display        *xdisplay      = meta_display_get_xdisplay (display);
+  Window          xwin;
+  gint            width, height;
+
+  /* Check if the screen is already managed */
+  if (meta_screen_get_compositor_data (screen))
+    return;
 
   info = g_new0 (MetaCompScreen, 1);
   /*
@@ -611,6 +619,13 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
     }
 
   clutter_actor_show (info->overlay_group);
+
+  /* Map overlay window before redirecting windows offscreen so we catch their
+   * contents until we show the stage.
+   */
+  XMapWindow (xdisplay, info->output);
+
+  redirect_windows (compositor, screen);
 }
 
 void


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