gtk+ r19870 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r19870 - in trunk: . gtk
- Date: Fri, 14 Mar 2008 02:45:44 +0000 (GMT)
Author: federico
Date: Fri Mar 14 02:45:44 2008
New Revision: 19870
URL: http://svn.gnome.org/viewvc/gtk+?rev=19870&view=rev
Log:
Hide the mouse cursor in the completion feedback window
2008-03-13 Federico Mena Quintero <federico novell com>
* gtk/gtkfilechooserentry.c (create_completion_feedback_window):
Set the mouse cursor of the feedback window to invisible, so that
we respect GtkEntry's invisible cursor while typing.
Signed-off-by: Federico Mena Quintero <federico gnu org>
Modified:
trunk/ChangeLog
trunk/gtk/gtkfilechooserentry.c
Modified: trunk/gtk/gtkfilechooserentry.c
==============================================================================
--- trunk/gtk/gtkfilechooserentry.c (original)
+++ trunk/gtk/gtkfilechooserentry.c Fri Mar 14 02:45:44 2008
@@ -851,6 +851,47 @@
}
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;
+ 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);
+
+ gdk_window_set_cursor (window, cursor);
+
+ gdk_cursor_unref (cursor);
+
+ g_object_unref (empty_bitmap);
+}
+
+static void
+completion_feedback_window_realize_cb (GtkWidget *widget,
+ gpointer data)
+{
+ /* We hide the mouse cursor inside the completion feedback window, since
+ * GtkEntry hides the cursor when the user types. We don't want the cursor to
+ * come back if the completion feedback ends up where the mouse is.
+ */
+ set_invisible_mouse_cursor (widget->window);
+}
+
+static void
create_completion_feedback_window (GtkFileChooserEntry *chooser_entry)
{
/* Stolen from gtk_tooltip_init() */
@@ -875,6 +916,9 @@
g_signal_connect (chooser_entry->completion_feedback_window, "expose_event",
G_CALLBACK (completion_feedback_window_expose_event_cb), chooser_entry);
+ g_signal_connect (chooser_entry->completion_feedback_window, "realize",
+ G_CALLBACK (completion_feedback_window_realize_cb), chooser_entry);
+ /* FIXME: connect to motion-notify-event, and *show* the cursor when the mouse moves */
chooser_entry->completion_feedback_label = gtk_label_new (NULL);
gtk_container_add (GTK_CONTAINER (alignment), chooser_entry->completion_feedback_label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]