[Xfce4-commits] [apps/xfdashboard] 03/04: cogl_texture_new_from_data() is deprecated since Cogl 1.18 so move to new function cogl_texture_2d_new_from_data()

noreply at xfce.org noreply at xfce.org
Tue Mar 24 10:25:21 CET 2015


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to annotated tag 0.2.3
in repository apps/xfdashboard.

commit ea67b84ce02f88bed9140b5b1ddd5673e9a62d0b
Author: Stephan Haller <nomad at froevel.de>
Date:   Wed Jul 23 10:34:53 2014 +0200

    cogl_texture_new_from_data() is deprecated since Cogl 1.18 so move to new function cogl_texture_2d_new_from_data()
---
 src/window-content.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/window-content.c b/src/window-content.c
index 6af7d93..34aeffd 100644
--- a/src/window-content.c
+++ b/src/window-content.c
@@ -564,6 +564,11 @@ static void _xfdashboard_window_content_set_window(XfdashboardWindowContent *sel
 	Display								*display;
 	GdkPixbuf							*windowIcon;
 	XWindowAttributes					windowAttrs;
+#if COGL_VERSION_CHECK(1, 18, 0)
+	ClutterBackend						*backend;
+	CoglContext							*context;
+	CoglError							*error;
+#endif
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_CONTENT(self));
 	g_return_if_fail(inWindow!=NULL && XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inWindow));
@@ -585,6 +590,40 @@ static void _xfdashboard_window_content_set_window(XfdashboardWindowContent *sel
 	 * a live updated texture for window in the next steps
 	 */
 	windowIcon=xfdashboard_window_tracker_window_get_icon(priv->window);
+#if COGL_VERSION_CHECK(1, 18, 0)
+	error=NULL;
+
+	backend=clutter_get_default_backend();
+	context=clutter_backend_get_cogl_context(backend);
+	priv->texture=cogl_texture_2d_new_from_data(context,
+												gdk_pixbuf_get_width(windowIcon),
+												gdk_pixbuf_get_height(windowIcon),
+												gdk_pixbuf_get_has_alpha(windowIcon) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
+												gdk_pixbuf_get_rowstride(windowIcon),
+												gdk_pixbuf_get_pixels(windowIcon),
+												&error);
+
+	if(!priv->texture || error)
+	{
+		/* Show warning */
+		g_warning(_("Could not create fallback texture for window '%s': %s"),
+					xfdashboard_window_tracker_window_get_title(priv->window),
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(priv->texture)
+		{
+			cogl_object_unref(priv->texture);
+			priv->texture=NULL;
+		}
+
+		if(error)
+		{
+			cogl_error_free(error);
+			error=NULL;
+		}
+	}
+#else
 	priv->texture=cogl_texture_new_from_data(gdk_pixbuf_get_width(windowIcon),
 												gdk_pixbuf_get_height(windowIcon),
 												COGL_TEXTURE_NONE,
@@ -592,6 +631,8 @@ static void _xfdashboard_window_content_set_window(XfdashboardWindowContent *sel
 												COGL_PIXEL_FORMAT_ANY,
 												gdk_pixbuf_get_rowstride(windowIcon),
 												gdk_pixbuf_get_pixels(windowIcon));
+#endif
+
 	priv->isFallback=TRUE;
 
 	/* Get X window and its attributes */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list