epiphany-extensions r1737 - trunk/extensions/auto-scroller



Author: atoker
Date: Tue Jun 17 13:40:34 2008
New Revision: 1737
URL: http://svn.gnome.org/viewvc/epiphany-extensions?rev=1737&view=rev

Log:
Make auto-scroller extension work with WebKit

Instead of using the DOM event, we use an ordinary GTK+ button press
event. This lacks some context that could be useful, but works well enough
for now.

DOM-based code is left in tree since we might be able to pick it up when
the DOM binding is done.


Modified:
   trunk/extensions/auto-scroller/ephy-auto-scroller-extension.c

Modified: trunk/extensions/auto-scroller/ephy-auto-scroller-extension.c
==============================================================================
--- trunk/extensions/auto-scroller/ephy-auto-scroller-extension.c	(original)
+++ trunk/extensions/auto-scroller/ephy-auto-scroller-extension.c	Tue Jun 17 13:40:34 2008
@@ -56,6 +56,7 @@
 	return scroller;
 }
 
+#if 0
 static gboolean
 dom_mouse_down_cb (EphyEmbed *embed,
 		   EphyEmbedEvent *event,
@@ -82,6 +83,29 @@
 
 	return TRUE;
 }
+#endif
+
+static gboolean
+button_press_cb (GtkWidget *widget,
+		   GdkEventButton *event,
+		   EphyWindow *window)
+{
+	EphyAutoScroller *scroller;
+	EphyEmbed *embed = (EphyEmbed*) gtk_widget_get_parent (gtk_widget_get_parent (widget));
+
+	// FIXME: This will swallow middle clicks on inputs and links.
+	if (event->button != 2)
+	{
+		return FALSE;
+	}
+
+	scroller = ensure_auto_scroller (window);
+	g_return_val_if_fail (scroller != NULL, FALSE);
+
+	ephy_auto_scroller_start (scroller, embed, event->x_root, event->y_root);
+
+	return TRUE;
+}
 
 static void
 impl_detach_window (EphyExtension *ext,
@@ -95,12 +119,19 @@
 		 EphyWindow *window,
 		 EphyEmbed *embed)
 {
+	GtkWidget* web_view;
 	LOG ("impl_attach_tab");
 
 	g_return_if_fail (embed != NULL);
 
+#if 0
 	g_signal_connect_object (embed, "ge-dom-mouse-down",
                                  G_CALLBACK (dom_mouse_down_cb), window, 0);
+#endif
+
+	web_view = gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (embed))));
+	g_signal_connect_object (web_view, "button_press_event",
+                                 G_CALLBACK (button_press_cb), window, 0);
 }
 
 static void
@@ -108,12 +139,19 @@
 		 EphyWindow *window,
 		 EphyEmbed *embed)
 {
+	GtkWidget *web_view;
 	LOG ("impl_detach_tab");
 
 	g_return_if_fail (embed != NULL);
 
+#if 0
 	g_signal_handlers_disconnect_by_func
 		(embed, G_CALLBACK (dom_mouse_down_cb), window);
+#endif
+
+	web_view = gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (embed))));
+	g_signal_handlers_disconnect_by_func
+		(web_view, G_CALLBACK (button_press_cb), window);
 }
 
 static void



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