diff src/gtkconv.c @ 6052:c062c4bf58ac

[gaim-migrate @ 6502] Should fix the ctrl+a/ctrl+home/ctrl+end crashes. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 07 Jul 2003 04:44:36 +0000
parents 0c4d0c93c8c5
children dc2124210882
line wrap: on
line diff
--- a/src/gtkconv.c	Mon Jul 07 02:59:13 2003 +0000
+++ b/src/gtkconv.c	Mon Jul 07 04:44:36 2003 +0000
@@ -1402,6 +1402,35 @@
 }
 
 /*
+ * This function exists to work around some gross bugs in GtkTextView.  
+ * Basically, we short circuit ctrl+a and ctrl+end because they make 
+ * Gaim go boom.
+ *
+ * It's supposed to be fixed in gtk2.2.  You can view the bug report at 
+ * http://bugzilla.gnome.org/show_bug.cgi?id=107939
+ */
+static gboolean
+textview_key_pressed_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
+{
+	if (event->state & GDK_CONTROL_MASK)
+		switch (event->keyval) {
+			case 'a':
+				return TRUE;
+				break;
+
+			case GDK_Home:
+				return TRUE;
+				break;
+
+			case GDK_End:
+				return TRUE;
+				break;
+		}
+
+	return FALSE;
+}
+
+/*
  * NOTE:
  *   This guy just kills a single right click from being propagated any 
  *   further.  I  have no idea *why* we need this, but we do ...  It 
@@ -3544,6 +3573,10 @@
 				25));
 
 	/* Connect the signal handlers. */
+	/* XXX - This first one should be removed eventually.  It exists to 
+	 * work around a gtk bug.  See the callback comments for more info. */
+	g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
+					 G_CALLBACK(textview_key_pressed_cb), conv);
 	g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event",
 							 G_CALLBACK(entry_key_pressed_cb_1),
 							 gtkconv->entry_buffer);