[evolution] Bug #604522 - Mouse wheel scroll doesn't work above inline images



commit 4dbd42ed5001401cb79917b6f49be0af81ccc28d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 11 13:30:10 2010 +0100

    Bug #604522 - Mouse wheel scroll doesn't work above inline images

 plugins/image-inline/image-inline.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index fdff39a..12568ee 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -259,6 +259,24 @@ size_allocate_cb (GtkHTMLEmbedded *embedded,
 }
 
 static void
+mouse_wheel_scroll_cb (GtkWidget *img_view, GdkScrollDirection direction, ImageInlinePObject *image_object)
+{
+	GtkHTML *html;
+	gint steps = 2;
+
+	g_return_if_fail (image_object != NULL);
+	g_return_if_fail (image_object->object.format != NULL);
+	g_return_if_fail (image_object->object.format->html != NULL);
+
+	html = image_object->object.format->html;
+
+	while (steps > 0) {
+		g_signal_emit_by_name (html, "scroll", (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_UP) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_RIGHT) ? GTK_SCROLL_STEP_FORWARD : GTK_SCROLL_STEP_BACKWARD, 2.0, NULL);
+		steps--;
+	}
+}
+
+static void
 org_gnome_image_inline_pobject_free (EMFormatHTMLPObject *object)
 {
 	ImageInlinePObject *image_object;
@@ -284,6 +302,9 @@ org_gnome_image_inline_pobject_free (EMFormatHTMLPObject *object)
 		g_signal_handlers_disconnect_by_func (
 			image_object->widget,
 			drag_data_get_cb, image_object);
+		g_signal_handlers_disconnect_by_func (
+			image_object->widget,
+			mouse_wheel_scroll_cb, image_object);
 
 		parent = gtk_widget_get_parent (image_object->widget);
 		if (parent != NULL)
@@ -388,6 +409,10 @@ org_gnome_image_inline_embed (EMFormatHTML *format,
 		embedded, "size-allocate",
 		G_CALLBACK (size_allocate_cb), image_object);
 
+	g_signal_connect (
+		image_view, "mouse-wheel-scroll",
+		G_CALLBACK (mouse_wheel_scroll_cb), image_object);
+
 	return TRUE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]