From 732b61f8a63db0f01ea3e524f20e74ddcbab5c48 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 28 May 2012 00:56:59 +0100 Subject: Stop using deprecated GdkBitmap in custom cursors Fixed bugs: - https://launchpad.net/bugs/943200 (bzr r11429) --- src/ui/widget/selected-style.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/ui/widget/selected-style.cpp') diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a60e3cc31..37b3f8a1a 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1253,30 +1253,27 @@ RotateableSwatch::do_motion(double by, guint modifier) { if (!cr_set && modifier != 3) { GtkWidget *w = GTK_WIDGET(gobj()); + GdkPixbuf *pixbuf = NULL; - GdkBitmap *bitmap = NULL; - GdkBitmap *mask = NULL; if (modifier == 2) { // saturation - sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_s_xpm); + pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_s_xpm); } else if (modifier == 1) { // lightness - sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_l_xpm); + pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_l_xpm); } else { // hue - sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_h_xpm); + pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_h_xpm); } - if ((bitmap != NULL) && (mask != NULL)) { - GtkStyle *style = gtk_widget_get_style(w); - cr = gdk_cursor_new_from_pixmap(bitmap, mask, - &style->black, - &style->white, - 16, 16); - g_object_unref (bitmap); - g_object_unref (mask); + + if (pixbuf != NULL) { + cr = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, 16, 16); + + g_object_unref(pixbuf); gdk_window_set_cursor(gtk_widget_get_window(w), cr); #if GTK_CHECK_VERSION(3,0,0) g_object_unref(cr); #else gdk_cursor_unref(cr); #endif + cr = NULL; cr_set = true; } } -- cgit v1.2.3