[mutter/wip/surface-content: 21/23] compositor: Delay meta_compositor_add_window until the first show



commit b9f18258fae11da27c1cfb0fab14677e5d104699
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 6 15:01:59 2014 -0500

    compositor: Delay meta_compositor_add_window until the first show
    
    In order for the compositor to properly determine whether a client
    is an X11 client or not, we need to wait until XWayland calls
    set_window_id to mark the surface as an XWayland client. To prevent
    the compositor from getting tripped up over this, make sure that
    the window has been fully initialized by the time we call
    meta_compositor_add_window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720631

 src/compositor/compositor.c |   26 ++++++++++----------------
 src/core/window.c           |   15 +++++++--------
 2 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 0fb8df9..6ed2df4 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -141,19 +141,6 @@ meta_compositor_destroy (MetaCompositor *compositor)
 }
 
 static void
-add_win (MetaWindow *window)
-{
-  MetaScreen           *screen = meta_window_get_screen (window);
-  MetaCompScreen        *info = meta_screen_get_compositor_data (screen);
-
-  g_return_if_fail (info != NULL);
-
-  meta_window_actor_new (window);
-
-  sync_actor_stacking (info);
-}
-
-static void
 process_damage (MetaCompositor     *compositor,
                 XDamageNotifyEvent *event,
                 MetaWindow         *window)
@@ -835,13 +822,20 @@ meta_compositor_add_window (MetaCompositor    *compositor,
 {
   MetaScreen *screen = meta_window_get_screen (window);
   MetaDisplay *display = meta_screen_get_display (screen);
+  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
 
-  DEBUG_TRACE ("meta_compositor_add_window\n");
-  meta_error_trap_push (display);
+  g_return_if_fail (info != NULL);
 
-  add_win (window);
+  /* Window was already added previously, probably coming
+   * back from hiding */
+  if (window->compositor_private != NULL)
+    return;
 
+  meta_error_trap_push (display);
+  meta_window_actor_new (window);
   meta_error_trap_pop (display);
+
+  sync_actor_stacking (info);
 }
 
 void
diff --git a/src/core/window.c b/src/core/window.c
index e08704d..df2a0a9 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1204,9 +1204,6 @@ _meta_window_shared_new (MetaDisplay         *display,
       set_net_wm_state (window);
     }
 
-  if (screen->display->compositor)
-    meta_compositor_add_window (screen->display->compositor, window);
-
   /* Sync stack changes */
   meta_stack_thaw (window->screen->stack);
 
@@ -1498,10 +1495,12 @@ meta_window_unmanage (MetaWindow  *window,
   if (window->display->compositor)
     {
       if (window->visible_to_compositor)
-        meta_compositor_hide_window (window->display->compositor, window,
-                                     META_COMP_EFFECT_DESTROY);
+        {
+          meta_compositor_hide_window (window->display->compositor, window,
+                                       META_COMP_EFFECT_DESTROY);
 
-      meta_compositor_remove_window (window->display->compositor, window);
+          meta_compositor_remove_window (window->display->compositor, window);
+        }
     }
 
   if (window->display->window_with_menu == window)
@@ -2757,8 +2756,8 @@ meta_window_show (MetaWindow *window)
               break;
             }
 
-          meta_compositor_show_window (window->display->compositor,
-                                       window, effect);
+          meta_compositor_add_window (window->display->compositor, window);
+          meta_compositor_show_window (window->display->compositor, window, effect);
         }
     }
 


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