[mutter] Pass CoglContext to cogl_texture_pixmap_x11_new()



commit d249cfd040c6df402730b12b990666cfee52a2d2
Author: Robert Bragg <robert linux intel com>
Date:   Tue Feb 21 16:31:53 2012 +0000

    Pass CoglContext to cogl_texture_pixmap_x11_new()
    
    The experimental Cogl api cogl_texture_pixmap_new() was recently changed
    so it now expects an explicit CoglContext argument and it can also
    return exceptions now via a GError. This patch updates mutters use of
    the api accordingly.

 src/compositor/meta-background-actor.c |   13 ++++++++++++-
 src/compositor/meta-shaped-texture.c   |   10 ++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 349f9b9..d70ae1b 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -28,6 +28,9 @@
 #define COGL_ENABLE_EXPERIMENTAL_API
 #include <cogl/cogl-texture-pixmap-x11.h>
 
+#define CLUTTER_ENABLE_EXPERIMENTAL_API
+#include <clutter/clutter.h>
+
 #include <X11/Xatom.h>
 
 #include "cogl-utils.h"
@@ -539,9 +542,11 @@ meta_background_actor_update (MetaScreen *screen)
   if (root_pixmap_id != None)
     {
       CoglHandle texture;
+      CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+      GError *error = NULL;
 
       meta_error_trap_push (display);
-      texture = cogl_texture_pixmap_x11_new (root_pixmap_id, FALSE);
+      texture = cogl_texture_pixmap_x11_new (ctx, root_pixmap_id, FALSE, &error);
       meta_error_trap_pop (display);
 
       if (texture != COGL_INVALID_HANDLE)
@@ -552,6 +557,12 @@ meta_background_actor_update (MetaScreen *screen)
           background->have_pixmap = True;
           return;
         }
+      else
+        {
+          g_warning ("Failed to create background texture from pixmap: %s",
+                     error->message);
+          g_error_free (error);
+        }
     }
 
   background->have_pixmap = False;
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 9f3567b..07bd93c 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -25,13 +25,15 @@
 
 #include <config.h>
 
+#define CLUTTER_ENABLE_EXPERIMENTAL_API
+#define COGL_ENABLE_EXPERIMENTAL_API
+
 #include <meta/meta-shaped-texture.h>
 #include "meta-texture-tower.h"
 #include "meta-texture-rectangle.h"
 
 #include <clutter/clutter.h>
 #include <cogl/cogl.h>
-#define COGL_ENABLE_EXPERIMENTAL_API
 #include <cogl/cogl-texture-pixmap-x11.h>
 #include <gdk/gdk.h> /* for gdk_rectangle_intersect() */
 #include <string.h>
@@ -708,7 +710,11 @@ meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
   priv->pixmap = pixmap;
 
   if (pixmap != None)
-    set_cogl_texture (stex, cogl_texture_pixmap_x11_new (pixmap, FALSE));
+    {
+      CoglContext *ctx =
+        clutter_backend_get_cogl_context (clutter_get_default_backend ());
+      set_cogl_texture (stex, cogl_texture_pixmap_x11_new (ctx, pixmap, FALSE, NULL));
+    }
   else
     set_cogl_texture (stex, COGL_INVALID_HANDLE);
 



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