changeset 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 a170c50b2a48
children 74b281b4ae29
files src/gtkconv.c src/protocols/oscar/oscar.c
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
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);
--- a/src/protocols/oscar/oscar.c	Mon Jul 07 02:59:13 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Jul 07 04:44:36 2003 +0000
@@ -6063,10 +6063,11 @@
 		char *buf = g_malloc(st.st_size);
 		file = fopen(iconfile, "rb");
 		if (file) {
+			md5_state_t *state;
 			char md5[16];
 			int len = fread(buf, 1, st.st_size, file);
 			fclose(file);
-			md5_state_t *state = g_malloc(sizeof(md5_state_t));
+			state = g_malloc(sizeof(md5_state_t));
 			md5_init(state);
 			md5_append(state, buf, len);
 			md5_finish(state, md5);