From e15bc372255ac0954b22218a38427dde34c23118 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 1 Mar 2013 14:41:11 -0500 Subject: [PATCH] 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 file changed, 31 insertions(+), 16 deletions(-) diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index c5021ebbc..20cbde4c6 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