changeset 10946:2d30f151146d

[gaim-migrate @ 12742] Fix the cursors to work as they were intended to. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 27 May 2005 03:14:45 +0000
parents 1ce8013f5642
children afc440485a9e
files src/gtkimhtml.c
diffstat 1 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Thu May 26 23:58:20 2005 +0000
+++ b/src/gtkimhtml.c	Fri May 27 03:14:45 2005 +0000
@@ -566,6 +566,23 @@
 	return FALSE;
 }
 
+gboolean gtk_enter_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer data)
+{
+	if (GTK_IMHTML(imhtml)->editable)
+		gdk_window_set_cursor(
+				gtk_text_view_get_window(GTK_TEXT_VIEW(imhtml),
+					GTK_TEXT_WINDOW_TEXT),
+				GTK_IMHTML(imhtml)->text_cursor);
+	else
+		gdk_window_set_cursor(
+				gtk_text_view_get_window(GTK_TEXT_VIEW(imhtml),
+					GTK_TEXT_WINDOW_TEXT),
+				GTK_IMHTML(imhtml)->arrow_cursor);
+
+	/* propagate the event normally */
+	return FALSE;
+}
+
 gboolean gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer data)
 {
 	/* when leaving the widget, clear any current & pending tooltips and restore the cursor */
@@ -587,10 +604,9 @@
 		g_source_remove(GTK_IMHTML(imhtml)->tip_timer);
 		GTK_IMHTML(imhtml)->tip_timer = 0;
 	}
-	if (GTK_IMHTML(imhtml)->editable)
-		gdk_window_set_cursor(event->window, GTK_IMHTML(imhtml)->text_cursor);
-	else
-		gdk_window_set_cursor(event->window, GTK_IMHTML(imhtml)->arrow_cursor);
+	gdk_window_set_cursor(
+			gtk_text_view_get_window(GTK_TEXT_VIEW(imhtml),
+				GTK_TEXT_WINDOW_TEXT), NULL);
 
 	/* propagate the event normally */
 	return FALSE;
@@ -1276,6 +1292,7 @@
 	g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL);
 	g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL);
+	g_signal_connect(G_OBJECT(imhtml), "enter-notify-event", G_CALLBACK(gtk_enter_event_notify), NULL);
 #if (!GTK_CHECK_VERSION(2,2,0))
 	/* See the comment for gtk_key_pressed_cb */
 	g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL);
@@ -1299,7 +1316,8 @@
 	g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set",
 		               G_CALLBACK(mark_set_so_update_selection_cb), imhtml);
 
-	gtk_widget_add_events(GTK_WIDGET(imhtml), GDK_LEAVE_NOTIFY_MASK);
+	gtk_widget_add_events(GTK_WIDGET(imhtml),
+			GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK);
 
 	imhtml->clipboard_text_string = NULL;
 	imhtml->clipboard_html_string = NULL;