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.
This commit is contained in:
Robert Bragg 2012-02-21 16:31:53 +00:00
parent 3cb912aee2
commit d249cfd040
2 changed files with 20 additions and 3 deletions

View File

@ -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;

View File

@ -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);