changeset 13551:40612ca80643

[gaim-migrate @ 15929] This patch from Fernando Herrera traps the expose events used to redraw animated images in a GtkIMHtml such that they do not cause a redraw of the entire conversation. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Thu, 23 Mar 2006 14:20:56 +0000
parents 47c12348cfd1
children ba0147a93c56
files src/gtkimhtml.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Wed Mar 22 07:09:08 2006 +0000
+++ b/src/gtkimhtml.c	Thu Mar 23 14:20:56 2006 +0000
@@ -4415,6 +4415,14 @@
 	gtk_imhtml_insert_smiley_at_iter(imhtml, sml, smiley, &iter);
 }
 
+static gboolean
+image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+{
+	GTK_WIDGET_CLASS(GTK_WIDGET_GET_CLASS(widget))->expose_event(widget, event);
+
+	return TRUE;
+}
+
 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter)
 {
 	GdkPixbuf *pixbuf = NULL;
@@ -4442,6 +4450,12 @@
 		g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free);
 		g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free);
 
+		/* This catches the expose events generated by animated
+		 * images, and ensures that they are handled by the image
+		 * itself, without propagating to the textview and causing
+		 * a complete refresh */
+		g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL);
+
 		gtk_widget_show(icon);
 		gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor);
 	} else if (imhtml_smiley != NULL && (imhtml->format_functions & GTK_IMHTML_SMILEY)) {