diff options
| author | Josh Andler <scislac@gmail.com> | 2006-02-03 19:45:56 +0000 |
|---|---|---|
| committer | scislac <scislac@users.sourceforge.net> | 2006-02-03 19:45:56 +0000 |
| commit | c09ba43ef8f1c3d58c326f39cafaa2ac1b784b7c (patch) | |
| tree | 1457b0f8686a78f1a60f519ea9ebe1762fe5d164 /src/sp-cursor.cpp | |
| parent | implement par_indent in flowtext, no ui yet, done via first character's dx (diff) | |
| download | inkscape-c09ba43ef8f1c3d58c326f39cafaa2ac1b784b7c.tar.gz inkscape-c09ba43ef8f1c3d58c326f39cafaa2ac1b784b7c.zip | |
Applying patch #1415498 by James Kilfiger / zeimusu - Allow color & transparency in mouse pointer
(bzr r68)
Diffstat (limited to 'src/sp-cursor.cpp')
| -rw-r--r-- | src/sp-cursor.cpp | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index f59c63487..75b0affe3 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -84,22 +84,38 @@ void sp_cursor_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, g GdkCursor *sp_cursor_new_from_xpm (gchar **xpm, gint hot_x, gint hot_y) { - GdkColor const fg = { 0, 0, 0, 0 }; - GdkColor const bg = { 0, 65535, 65535, 65535 }; - - GdkBitmap *bitmap = NULL; - GdkBitmap *mask = NULL; - - sp_cursor_bitmap_and_mask_from_xpm (&bitmap, &mask, xpm); - if ( bitmap != NULL && mask != NULL ) { - GdkCursor *new_cursor = gdk_cursor_new_from_pixmap (bitmap, mask, - &fg, &bg, - hot_x, hot_y); - g_object_unref (bitmap); - g_object_unref (mask); +GdkDisplay *display=gdk_display_get_default(); + if ( + gdk_display_supports_cursor_alpha(display) & + gdk_display_supports_cursor_color(display) + ) + { + GdkPixbuf *pixbuf=NULL; + GdkCursor *new_cursor=NULL; + pixbuf=gdk_pixbuf_new_from_xpm_data((const char**)xpm); + if (pixbuf != NULL){ + new_cursor = gdk_cursor_new_from_pixbuf(display,pixbuf,hot_x,hot_y); + } return new_cursor; } - + else + { + GdkColor const fg = { 0, 0, 0, 0 }; + GdkColor const bg = { 0, 65535, 65535, 65535 }; + + GdkBitmap *bitmap = NULL; + GdkBitmap *mask = NULL; + + sp_cursor_bitmap_and_mask_from_xpm (&bitmap, &mask, xpm); + if ( bitmap != NULL && mask != NULL ) { + GdkCursor *new_cursor = gdk_cursor_new_from_pixmap (bitmap, mask, + &fg, &bg, + hot_x, hot_y); + g_object_unref (bitmap); + g_object_unref (mask); + return new_cursor; + } + } return NULL; } |
