[Xfce4-commits] <midori:master> Ensure link URI is updated before it is used
Christian Dywan
noreply at xfce.org
Tue Sep 21 00:10:03 CEST 2010
Updating branch refs/heads/master
to 5bdf3764872fd249b8e43c179641ff734a7d8849 (commit)
from 16ce2e9516676e00c0f441a04c3305614de4d32a (commit)
commit 5bdf3764872fd249b8e43c179641ff734a7d8849
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Sep 21 00:08:10 2010 +0200
Ensure link URI is updated before it is used
Apparently the URI obtained from hovering-over-link can be
mangled, so a # would be interpreted as a fragment identifier.
midori/midori-view.c | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/midori/midori-view.c b/midori/midori-view.c
index c75912b..b4f79ee 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -1438,6 +1438,35 @@ webkit_web_view_hovering_over_link_cb (WebKitWebView* web_view,
g_object_set (view, "statusbar-text", link_uri, NULL);
}
+static void
+midori_view_ensure_link_uri (MidoriView* view,
+ gint *x,
+ gint *y)
+{
+ g_return_if_fail (MIDORI_IS_VIEW (view));
+
+ #if WEBKIT_CHECK_VERSION (1, 1, 15)
+ if (view->web_view && view->web_view->window)
+ {
+ gint ex, ey;
+ GdkEventButton event;
+
+ gdk_window_get_pointer (view->web_view->window, &ex, &ey, NULL);
+ if (x != NULL)
+ *x = ex;
+ if (y != NULL)
+ *y = ey;
+
+ event.x = ex;
+ event.y = ey;
+ katze_object_assign (view->hit_test, webkit_web_view_get_hit_test_result (
+ WEBKIT_WEB_VIEW (view->web_view), &event));
+ katze_assign (view->link_uri,
+ katze_object_get_string (view->hit_test, "link-uri"));
+ }
+ #endif
+}
+
#define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \
| GDK_MOD1_MASK | GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK )
@@ -1453,6 +1482,7 @@ gtk_widget_button_press_event_cb (WebKitWebView* web_view,
gboolean background;
event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;
+ midori_view_ensure_link_uri (view, NULL, NULL);
link_uri = midori_view_get_link_uri (view);
switch (event->button)
@@ -1950,20 +1980,12 @@ midori_view_populate_popup (MidoriView* view,
#if WEBKIT_CHECK_VERSION (1, 1, 15)
gint x, y;
- GdkEventButton event;
WebKitHitTestResultContext context;
gboolean is_image;
gboolean is_media;
- gdk_window_get_pointer (view->web_view->window, &x, &y, NULL);
- event.x = x;
- event.y = y;
- katze_object_assign (view->hit_test,
- webkit_web_view_get_hit_test_result (web_view, &event));
+ midori_view_ensure_link_uri (view, &x, &y);
context = katze_object_get_int (view->hit_test, "context");
- /* Ensure view->link_uri is correct. */
- katze_assign (view->link_uri,
- katze_object_get_string (view->hit_test, "link-uri"));
has_selection = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION;
/* Ensure view->selected_text */
midori_view_has_selection (view);
More information about the Xfce4-commits
mailing list