diff options
author | Benjamin Otte <otte@redhat.com> | 2010-08-14 06:38:11 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-09-26 15:02:59 +0200 |
commit | 806a7239aef9f20f06391ca01e991afd79b27874 (patch) | |
tree | 2f592a6edd0adeacaff3f6e823f47927579bc421 /tests | |
parent | 8b4d50dd1d054325b31aecc53bb117c76774092f (diff) | |
download | gtk+-806a7239aef9f20f06391ca01e991afd79b27874.tar.gz |
widget: shape_combine_mask => shape_cobine_region
Replace gtk_widget_shape_combine_region() with
gtk_widget_shape_combine_mask() and
gtk_widget_input_shape_combine_region() with
gtk_widget_input_shape_combine_mask().
As GdkBitmap is going away, and the region equivalents already exist,
this seems like pretty much the default step to take.
Includes code to fix up the users.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testgtk.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c index 7ee83ad162..4649754028 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -7263,8 +7263,10 @@ shape_create_icon (GdkScreen *screen, GtkWidget *image; GtkWidget *fixed; CursorOffset* icon_pos; - GdkBitmap *mask; + cairo_surface_t *mask; + cairo_region_t *mask_region; GdkPixbuf *pixbuf; + cairo_t *cr; /* * GDK_WINDOW_TOPLEVEL works also, giving you a title border @@ -7288,19 +7290,26 @@ shape_create_icon (GdkScreen *screen, pixbuf = gdk_pixbuf_new_from_file (xpm_file, NULL); g_assert (pixbuf); /* FIXME: error handling */ - gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf, - gtk_widget_get_colormap (window), - NULL, - &mask, - 128); + mask = cairo_image_surface_create (CAIRO_FORMAT_A1, + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf)); + cr = cairo_create (mask); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); + + mask_region = gdk_cairo_region_create_from_surface (mask); + cairo_region_translate (mask_region, px, py); + image = gtk_image_new_from_pixbuf (pixbuf); gtk_fixed_put (GTK_FIXED (fixed), image, px,py); gtk_widget_show (image); - gtk_widget_shape_combine_mask (window, mask, px, py); + gtk_widget_shape_combine_region (window, mask_region); - g_object_unref (mask); + cairo_region_destroy (mask_region); + cairo_surface_destroy (mask); g_object_unref (pixbuf); g_signal_connect (window, "button_press_event", |