Commit 5ed9d809 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

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: default avatarFederico Mena Quintero <federico@gnu.org>

svn path=/trunk/; revision=19870
parent d31b7a0d
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.
2008-03-13 Federico Mena Quintero <federico@novell.com>
* gtk/gtkfilechooserentry.c (show_completion_feedback_window): Put
......
......@@ -850,6 +850,47 @@ completion_feedback_window_expose_event_cb (GtkWidget *widget,
return FALSE;
}
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)
{
......@@ -875,6 +916,9 @@ create_completion_feedback_window (GtkFileChooserEntry *chooser_entry)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment