[epiphany-extensions] Fix auto-scroller extension to use the new WebKitHitTestResult stuff
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany-extensions] Fix auto-scroller extension to use the new WebKitHitTestResult stuff
- Date: Tue, 22 Sep 2009 10:43:27 +0000 (UTC)
commit c3584c630ac8ec80288f56bdb3ecc350b533d07e
Author: Xan Lopez <xan gnome org>
Date: Tue Sep 22 13:43:09 2009 +0300
Fix auto-scroller extension to use the new WebKitHitTestResult stuff
Bug #589560
.../auto-scroller/ephy-auto-scroller-extension.c | 62 +++++---------------
1 files changed, 16 insertions(+), 46 deletions(-)
---
diff --git a/extensions/auto-scroller/ephy-auto-scroller-extension.c b/extensions/auto-scroller/ephy-auto-scroller-extension.c
index 188cc44..f6c54fa 100644
--- a/extensions/auto-scroller/ephy-auto-scroller-extension.c
+++ b/extensions/auto-scroller/ephy-auto-scroller-extension.c
@@ -55,21 +55,23 @@ ensure_auto_scroller (EphyWindow *window)
return scroller;
}
-#if 0
static gboolean
-dom_mouse_down_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
+dom_mouse_down_cb (EphyWebView *view,
+ GdkEventButton *event,
EphyWindow *window)
{
EphyAutoScroller *scroller;
- EphyEmbedEventContext context;
+ guint context;
guint button, x, y;
+ WebKitHitTestResult *hit_test;
- button = ephy_embed_event_get_button (event);
- context = ephy_embed_event_get_context (event);
+ button = event->button;
+ hit_test = webkit_web_view_get_hit_test_result (WEBKIT_WEB_VIEW (view), event);
+ g_object_get (hit_test, "context", &context, NULL);
+ g_object_unref (hit_test);
- if (button != 2 || (context & EPHY_EMBED_CONTEXT_INPUT) ||
- (context & EPHY_EMBED_CONTEXT_LINK))
+ if (button != 2 || (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) ||
+ (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK))
{
return FALSE;
}
@@ -77,31 +79,9 @@ dom_mouse_down_cb (EphyEmbed *embed,
scroller = ensure_auto_scroller (window);
g_return_val_if_fail (scroller != NULL, FALSE);
- ephy_embed_event_get_coords (event, &x, &y);
- ephy_auto_scroller_start (scroller, embed, x, y);
-
- return TRUE;
-}
-#endif
-
-static gboolean
-button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- EphyWindow *window)
-{
- EphyAutoScroller *scroller;
- EphyEmbed *embed = (EphyEmbed*) 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);
+ x = (guint)event->x_root;
+ y = (guint)event->y_root;
+ ephy_auto_scroller_start (scroller, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view), x, y);
return TRUE;
}
@@ -123,14 +103,9 @@ impl_attach_tab (EphyExtension *ext,
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 = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- g_signal_connect_object (web_view, "button_press_event",
- G_CALLBACK (button_press_cb), window, 0);
+ g_signal_connect_object (web_view, "button-press-event",
+ G_CALLBACK (dom_mouse_down_cb), window, 0);
}
static void
@@ -143,14 +118,9 @@ impl_detach_tab (EphyExtension *ext,
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 = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
g_signal_handlers_disconnect_by_func
- (web_view, G_CALLBACK (button_press_cb), window);
+ (web_view, G_CALLBACK (dom_mouse_down_cb), window);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]