[gnome-shell] Add the root pixmap source actor to the stage



commit 315da57c97ae738fc345ff07d375203235bf0cc4
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Jun 6 13:03:24 2009 -0400

    Add the root pixmap source actor to the stage
    
    With clutter changes, we can now no longer clone an actor unless
    it is part of a stage. So, we hide the root pixmap source, and
    add it.
    
    This means that the logic to free the source actor when the
    last clone disappears no longer applies, since the stage will also
    reference it; so we just leave the actor around permanently.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=585012
---
 src/shell-global.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/shell-global.c b/src/shell-global.c
index f7c0500..f3a4185 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -44,7 +44,7 @@ struct _ShellGlobal {
   const char *configdir;
 
   /* Displays the root window; see shell_global_create_root_pixmap_actor() */
-  ClutterGLXTexturePixmap *root_pixmap;
+  ClutterActor *root_pixmap;
 };
 
 enum {
@@ -1002,23 +1002,27 @@ ClutterActor *
 shell_global_create_root_pixmap_actor (ShellGlobal *global)
 {
   GdkWindow *window;
-  gboolean created_new_pixmap = FALSE;
-  ClutterActor *clone;
+  ClutterActor *stage;
 
   /* The actor created is actually a ClutterClone of global->root_pixmap. */
 
   if (global->root_pixmap == NULL)
     {
-      global->root_pixmap = CLUTTER_GLX_TEXTURE_PIXMAP (clutter_glx_texture_pixmap_new ());
+      global->root_pixmap = clutter_glx_texture_pixmap_new ();
 
       /* The low and medium quality filters give nearest-neighbor resizing. */
       clutter_texture_set_filter_quality (CLUTTER_TEXTURE (global->root_pixmap),
                                           CLUTTER_TEXTURE_QUALITY_HIGH);
 
-      /* The pixmap actor is only referenced by its clones. */
-      g_object_ref_sink (global->root_pixmap);
+      /* We can only clone an actor within a stage, so we hide the source
+       * texture then add it to the stage */
+      clutter_actor_hide (global->root_pixmap);
+      stage = mutter_plugin_get_stage (global->plugin);
+      clutter_container_add_actor (CLUTTER_CONTAINER (stage),
+                                   global->root_pixmap);
 
-      g_signal_connect (G_OBJECT (global->root_pixmap), "destroy",
+      /* This really should never happen; but just in case... */
+      g_signal_connect (global->root_pixmap, "destroy",
                         G_CALLBACK (root_pixmap_destroy), global);
 
       /* Metacity handles changes to some root window properties in its global
@@ -1034,16 +1038,9 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
       gdk_window_add_filter (window, root_window_filter, global);
 
       update_root_window_pixmap (global);
-
-      created_new_pixmap = TRUE;
     }
 
-  clone = clutter_clone_new (CLUTTER_ACTOR (global->root_pixmap));
-
-  if (created_new_pixmap)
-    g_object_unref(global->root_pixmap);
-
-  return clone;
+  return clutter_clone_new (global->root_pixmap);
 }
 
 void



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