diff options
author | Rob Kendrick <rjek@netsurf-browser.org> | 2007-09-28 23:54:30 +0000 |
---|---|---|
committer | Rob Kendrick <rjek@netsurf-browser.org> | 2007-09-28 23:54:30 +0000 |
commit | dc234235572e52fe5b7cf6d3a6b4a02552ada120 (patch) | |
tree | 984c2ed0cda103806503c840e5b969061f18d436 /gtk | |
parent | fddee1c89411b8faecb13cc5c588de1707cf7d7c (diff) | |
download | netsurf-dc234235572e52fe5b7cf6d3a6b4a02552ada120.tar.gz netsurf-dc234235572e52fe5b7cf6d3a6b4a02552ada120.tar.bz2 |
Use custom RISC OS-like popup menu cursor on select boxes
svn path=/trunk/netsurf/; revision=3603
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtk_window.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/gtk/gtk_window.c b/gtk/gtk_window.c index 9f790ba44..c6dc36326 100644 --- a/gtk/gtk_window.c +++ b/gtk/gtk_window.c @@ -78,6 +78,7 @@ static gboolean nsgtk_window_size_allocate_event(GtkWidget *, GtkAllocation *, /* Other useful bits */ static void nsgtk_redraw_caret(struct gui_window *g); +static GdkCursor *nsgtk_create_menu_cursor(void); nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g) { @@ -676,6 +677,39 @@ void gui_window_update_extent(struct gui_window *g) } +static GdkCursor *nsgtk_create_menu_cursor(void) +{ + static char menu_cursor_bits[] = { + 0x00, 0x00, 0x80, 0x7F, 0x88, 0x40, 0x9E, 0x5E, 0x88, 0x40, 0x80, 0x56, + 0x80, 0x40, 0x80, 0x5A, 0x80, 0x40, 0x80, 0x5E, 0x80, 0x40, 0x80, 0x56, + 0x80, 0x40, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, }; + + static char menu_cursor_mask_bits[] = { + 0xC0, 0xFF, 0xC8, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xC8, 0xFF, + 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, + 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0x00, 0x00, }; + + static GdkCursor *r; + static GdkColor fg = { 0, 0, 0, 0 }; + static GdkColor bg = { 0, 65535, 65535, 65535 }; + + GdkPixmap *source, *mask; + + if (r != NULL) + return r; + + source = gdk_bitmap_create_from_data(NULL, menu_cursor_bits, + 16, 16); + mask = gdk_bitmap_create_from_data (NULL, menu_cursor_mask_bits, + 16, 16); + + r = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 8, 8); + gdk_pixmap_unref(source); + gdk_pixmap_unref(mask); + + return r; +} + void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) { GdkCursor *cursor = NULL; @@ -731,7 +765,8 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) cursortype = GDK_QUESTION_ARROW; break; case GUI_POINTER_MENU: - cursortype = GDK_CENTER_PTR; + cursor = nsgtk_create_menu_cursor(); + nullcursor = true; break; case GUI_POINTER_PROGRESS: /* In reality, this needs to be the funky left_ptr_watch |