From d249cfd040c6df402730b12b990666cfee52a2d2 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 21 Feb 2012 16:31:53 +0000 Subject: [PATCH] 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 349f9b90f..d70ae1b6b 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 +#define CLUTTER_ENABLE_EXPERIMENTAL_API +#include + #include #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 9f3567b14..07bd93c99 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -25,13 +25,15 @@ #include +#define CLUTTER_ENABLE_EXPERIMENTAL_API +#define COGL_ENABLE_EXPERIMENTAL_API + #include #include "meta-texture-tower.h" #include "meta-texture-rectangle.h" #include #include -#define COGL_ENABLE_EXPERIMENTAL_API #include #include /* for gdk_rectangle_intersect() */ #include @@ -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);