[gnome-shell] layout: Use a MetaBackgroundActor, not a custom ClutterX11TexturePixmap



commit 85728f0d151a805027cd611a98e79546d9a850f9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Oct 26 11:09:36 2012 -0400

    layout: Use a MetaBackgroundActor, not a custom ClutterX11TexturePixmap
    
    While looking at how the plymouth implementation was built, I was so
    short-sighted and focused on the string "_XROOTPMAP_ID" that I didn't
    realize it was the name of the standard background on the root window.
    Remove our own implementation, and switch to using a standard mutter
    MetaBackgroundActor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682428

 js/ui/layout.js    |   22 +++++++++++-----------
 src/shell-global.c |   40 ----------------------------------------
 src/shell-global.h |    2 --
 3 files changed, 11 insertions(+), 53 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index ad260ec..168b986 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -104,7 +104,7 @@ const LayoutManager = new Lang.Class({
         this.primaryMonitor = null;
         this.primaryIndex = -1;
         this._hotCorners = [];
-        this._rootPixmap = null;
+        this._background = null;
         this._leftPanelBarrier = 0;
         this._rightPanelBarrier = 0;
         this._trayBarrier = 0;
@@ -333,30 +333,30 @@ const LayoutManager = new Lang.Class({
         // to the greeter. Otherwise, we'll just animate the panel,
         // as usual.
         if (Main.sessionMode.isGreeter) {
-            this._rootPixmap = global.create_xrootpmap_texture();
-            if (this._rootPixmap != null) {
-                Main.uiGroup.add_actor(this._rootPixmap);
-                Tweener.addTween(this._rootPixmap,
+            this._background = Meta.BackgroundActor.new_for_screen(global.screen);
+            if (this._background != null) {
+                Main.uiGroup.add_actor(this._background);
+                Tweener.addTween(this._background,
                                  { opacity: 0,
                                    time: PLYMOUTH_TRANSITION_TIME,
                                    transition: 'linear',
-                                   onComplete: this._fadeRootpmapComplete,
+                                   onComplete: this._fadeBackgroundComplete,
                                    onCompleteScope: this });
                 plymouthTransitionRunning = true;
             }
         }
 
         if (!plymouthTransitionRunning)
-            this._fadeRootpmapComplete();
+            this._fadeBackgroundComplete();
     },
 
-    _fadeRootpmapComplete: function() {
+    _fadeBackgroundComplete: function() {
         // Don't animate the strut
         this._chrome.freezeUpdateRegions();
 
-        if (this._rootPixmap != null) {
-            this._rootPixmap.destroy();
-            this._rootPixmap = null;
+        if (this._background != null) {
+            this._background.destroy();
+            this._background = null;
         }
 
         Tweener.addTween(this.panelBox,
diff --git a/src/shell-global.c b/src/shell-global.c
index d82885d..c95f078 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1693,43 +1693,3 @@ shell_global_get_session_mode (ShellGlobal *global)
 
   return global->session_mode;
 }
-
-/**
- * shell_global_create_xrootpmap_texture:
- * @global: The #ShellGlobal
- *
- * This returns the _XROOTPMAP_ID pixmap that gdm should have stuffed
- * in the root window. The goal here is to allow a smooth fade between
- * plymouth and the shell greeter. This is also a workaround for gjs not
- * supporting raw xlib types.
- *
- * Returns: (transfer floating): A #ClutterActor that represents the
- * _XROOTPMAP_ID pixmap property from the root window.
- */
-ClutterActor *
-shell_global_create_xrootpmap_texture (ShellGlobal *global)
-{
-  Atom res_type;
-  int res_format;
-  unsigned long res_nitems, bytesafter;
-  unsigned char *data;
-  Pixmap root_pixmap_id = None;
-
-  g_return_val_if_fail (SHELL_IS_GLOBAL (global), NULL);
-
-  if (XGetWindowProperty (global->xdisplay,
-                          DefaultRootWindow (global->xdisplay),
-                          XInternAtom (global->xdisplay, "_XROOTPMAP_ID", False),
-                          0, G_MAXLONG, False, XA_PIXMAP,
-                          &res_type, &res_format, &res_nitems, &bytesafter, &data) == Success)
-    {
-      if (res_type == XA_PIXMAP && res_format == 32 && res_nitems == 1)
-        root_pixmap_id = * (Pixmap *) data;
-      XFree (data);
-    }
-
-  if (root_pixmap_id != None)
-    return clutter_x11_texture_pixmap_new_with_pixmap (root_pixmap_id);
-  else
-    return NULL;
-}
diff --git a/src/shell-global.h b/src/shell-global.h
index 693cb41..95c18e0 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -136,8 +136,6 @@ void     shell_global_reexec_self               (ShellGlobal  *global);
 
 const char *     shell_global_get_session_mode  (ShellGlobal  *global);
 
-ClutterActor * shell_global_create_xrootpmap_texture (ShellGlobal *global);
-
 G_END_DECLS
 
 #endif /* __SHELL_GLOBAL_H__ */



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