[gnome-shell] StTextureCache: adapt to MetaWindow changing icon prop type
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StTextureCache: adapt to MetaWindow changing icon prop type
- Date: Tue, 13 Jan 2015 15:07:53 +0000 (UTC)
commit af889168f0fe572b31a9ec28e4cffffdcc1a0016
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Jan 12 21:21:39 2015 +0100
StTextureCache: adapt to MetaWindow changing icon prop type
Mutter change is
https://git.gnome.org/browse/mutter/commit/?id=af7f51b992b20da543312fa9fdf1dcef39704b37
https://bugzilla.gnome.org/show_bug.cgi?id=742824
js/ui/ctrlAltTab.js | 2 +-
src/shell-app.c | 6 +++---
src/st/st-texture-cache.c | 34 +++++++++++++++++++++-------------
src/st/st-texture-cache.h | 7 +++----
4 files changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index 5694990..082d329 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -100,7 +100,7 @@ const CtrlAltTabManager = new Lang.Class({
if (app)
icon = app.create_icon_texture(POPUP_APPICON_SIZE);
else
- icon = textureCache.bind_pixbuf_property(windows[i], 'icon');
+ icon = textureCache.bind_cairo_surface_property(windows[i], 'icon');
}
items.push({ name: windows[i].title,
diff --git a/src/shell-app.c b/src/shell-app.c
index 2436239..94b2951 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -189,9 +189,9 @@ window_backed_app_get_icon (ShellApp *app,
}
window = window_backed_app_get_window (app);
- actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
- G_OBJECT (window),
- "icon");
+ actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
+ G_OBJECT (window),
+ "icon");
g_object_set (actor, "width", (float) size, "height", (float) size, NULL);
return actor;
}
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index ccee96c..d392844 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -628,18 +628,26 @@ static void
st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
const char *propname)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
CoglTexture *texdata;
+ ClutterBackend *backend = clutter_get_default_backend ();
+ CoglContext *ctx = clutter_backend_get_cogl_context (backend);
- g_object_get (bind->source, propname, &pixbuf, NULL);
-
- g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
+ g_object_get (bind->source, propname, &surface, NULL);
- if (pixbuf != NULL)
+ if (surface != NULL &&
+ cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE &&
+ (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32 ||
+ cairo_image_surface_get_format (surface) == CAIRO_FORMAT_RGB24))
{
- texdata = pixbuf_to_cogl_texture (pixbuf);
- g_object_unref (pixbuf);
-
+ texdata = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx,
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface),
+ cairo_image_surface_get_format (surface) ==
CAIRO_FORMAT_ARGB32 ?
+ COGL_PIXEL_FORMAT_BGRA_8888 :
COGL_PIXEL_FORMAT_BGR_888,
+ cairo_image_surface_get_stride (surface),
+ cairo_image_surface_get_data (surface),
+ NULL));
clutter_texture_set_cogl_texture (bind->texture, texdata);
cogl_object_unref (texdata);
@@ -677,12 +685,12 @@ st_texture_cache_free_bind (gpointer data)
}
/**
- * st_texture_cache_bind_pixbuf_property:
+ * st_texture_cache_bind_cairo_surface_property:
* @cache:
* @object: A #GObject with a property @property_name of type #GdkPixbuf
* @property_name: Name of a property
*
- * Create a #ClutterTexture which tracks the #GdkPixbuf value of a GObject property
+ * Create a #ClutterTexture which tracks the #cairo_surface_t value of a GObject property
* named by @property_name. Unlike other methods in StTextureCache, the underlying
* #CoglTexture is not shared by default with other invocations to this method.
*
@@ -692,9 +700,9 @@ st_texture_cache_free_bind (gpointer data)
* Return value: (transfer none): A new #ClutterActor
*/
ClutterActor *
-st_texture_cache_bind_pixbuf_property (StTextureCache *cache,
- GObject *object,
- const char *property_name)
+st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
+ GObject *object,
+ const char *property_name)
{
ClutterTexture *texture;
gchar *notify_key;
diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h
index 48a7781..e7d3a50 100644
--- a/src/st/st-texture-cache.h
+++ b/src/st/st-texture-cache.h
@@ -28,7 +28,6 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter.h>
#include <st/st-types.h>
@@ -77,9 +76,9 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
GFunc load_callback,
gpointer user_data);
-ClutterActor *st_texture_cache_bind_pixbuf_property (StTextureCache *cache,
- GObject *object,
- const char *property_name);
+ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
+ GObject *object,
+ const char *property_name);
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
StThemeNode *theme_node,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]