From aaf70d13278494bb5c125ade8da30b06c5098562 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 6 Aug 2010 22:37:34 +0200 Subject: [PATCH] testgtk: Use Cairo to load XBM image This should really use GdkPixbuf, but apparently we can't load XBM images. And I'm too lazy to convert it. --- tests/testgtk.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/testgtk.c b/tests/testgtk.c index 2f1a931870..0260a55acb 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -7425,8 +7425,9 @@ create_wmhints (GtkWidget *widget) GtkWidget *button; GtkWidget *box1; GtkWidget *box2; - GdkBitmap *circles; + cairo_surface_t *image; + cairo_t *cr; if (!window) { @@ -7444,10 +7445,17 @@ create_wmhints (GtkWidget *widget) gtk_widget_realize (window); - circles = gdk_bitmap_create_from_data (window->window, - (gchar *) circles_bits, - circles_width, - circles_height); + circles = gdk_pixmap_new (window->window, circles_width, circles_height, 1); + cr = gdk_cairo_create (circles); + image = cairo_image_surface_create_for_data (circles_bits, CAIRO_FORMAT_A1, + circles_width, circles_height, + circles_width / 8); + cairo_set_source_surface (cr, image, 0, 0); + cairo_surface_destroy (image); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr); + cairo_destroy (cr); + gdk_window_set_icon (window->window, NULL, circles, circles);