From b6b52376631e52542237b7f229bb67ab57332746 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 Jan 2009 02:45:19 +0000 Subject: [PATCH] Replace several implementation of blank cursor setting by * gtk/gtkentry.c: * gtk/gtkfilechooserentry.c: * gtk/gtktextview.c: Replace several implementation of blank cursor setting by GDK_BLANK_CURSOR. svn path=/trunk/; revision=22148 --- ChangeLog | 7 +++++++ gtk/gtkentry.c | 25 ++++++------------------- gtk/gtkfilechooserentry.c | 22 +++------------------- gtk/gtktextview.c | 23 +++++------------------ 4 files changed, 21 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index 487439c72e..9ef794a388 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-19 Matthias Clasen + + * gtk/gtkentry.c: + * gtk/gtkfilechooserentry.c: + * gtk/gtktextview.c: Replace several implementation of + blank cursor setting by GDK_BLANK_CURSOR. + 2009-01-19 Matthias Clasen * gdk/gdkcursor.c: diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index c9bb4ca061..6ed922332f 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3782,28 +3782,15 @@ gtk_entry_motion_notify (GtkWidget *widget, static void set_invisible_cursor (GdkWindow *window) { - GdkBitmap *empty_bitmap; + GdkDisplay *display; GdkCursor *cursor; - GdkColor useless; - char invisible_cursor_bits[] = { 0x0 }; - - useless.red = useless.green = useless.blue = 0; - useless.pixel = 0; - - empty_bitmap = gdk_bitmap_create_from_data (window, - invisible_cursor_bits, - 1, 1); - - cursor = gdk_cursor_new_from_pixmap (empty_bitmap, - empty_bitmap, - &useless, - &useless, 0, 0); - + + display = gdk_drawable_get_display (window); + cursor = gdk_cursor_new_for_display (display, GDK_BLANK_CURSOR); + gdk_window_set_cursor (window, cursor); - + gdk_cursor_unref (cursor); - - g_object_unref (empty_bitmap); } static void diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 94b2a9820a..ea71fa6683 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -862,31 +862,15 @@ completion_feedback_window_expose_event_cb (GtkWidget *widget, static void set_invisible_mouse_cursor (GdkWindow *window) { - /* Stolen from gtkentry.c:set_invisible_cursor() */ - /* FIXME: implement a stupid public gdk_window_set_invisible_mouse_cursor() */ - - GdkBitmap *empty_bitmap; + GdkDisplay *display; GdkCursor *cursor; - GdkColor useless; - char invisible_cursor_bits[] = { 0x0 }; - useless.red = useless.green = useless.blue = 0; - useless.pixel = 0; - - empty_bitmap = gdk_bitmap_create_from_data (window, - invisible_cursor_bits, - 1, 1); - - cursor = gdk_cursor_new_from_pixmap (empty_bitmap, - empty_bitmap, - &useless, - &useless, 0, 0); + display = gdk_drawable_get_display (window); + cursor = gdk_cursor_new_for_display (display, GDK_BLANK_CURSOR); gdk_window_set_cursor (window, cursor); gdk_cursor_unref (cursor); - - g_object_unref (empty_bitmap); } static void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 5f1331e82e..e9bc867a91 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3988,28 +3988,15 @@ gtk_text_view_state_changed (GtkWidget *widget, static void set_invisible_cursor (GdkWindow *window) { - GdkBitmap *empty_bitmap; + GdkDisplay *display; GdkCursor *cursor; - GdkColor useless; - char invisible_cursor_bits[] = { 0x0 }; - - useless.red = useless.green = useless.blue = 0; - useless.pixel = 0; - - empty_bitmap = gdk_bitmap_create_from_data (window, - invisible_cursor_bits, - 1, 1); - - cursor = gdk_cursor_new_from_pixmap (empty_bitmap, - empty_bitmap, - &useless, - &useless, 0, 0); - + + display = gdk_drawable_get_display (window); + cursor = gdk_cursor_new_for_display (display, GDK_BLANK_CURSOR); + gdk_window_set_cursor (window, cursor); gdk_cursor_unref (cursor); - - g_object_unref (empty_bitmap); } static void