From: Daniel Carl Date: Sat, 4 Jan 2014 15:55:54 +0000 (+0100) Subject: Allow to open links into new window by ctrl and left mouse. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=d68f77738257f89f8a4819f61661481c9c4442a3;p=vimb.git Allow to open links into new window by ctrl and left mouse. --- diff --git a/src/main.c b/src/main.c index 09460dc..e2899e7 100644 --- a/src/main.c +++ b/src/main.c @@ -800,15 +800,17 @@ static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event) WebKitHitTestResult *result = webkit_web_view_get_hit_test_result(webview, event); g_object_get(result, "context", &context, NULL); - if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) { + if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) { + if (event->button == 2 || (event->button == 1 && event->state & GDK_CONTROL_MASK)) { + /* ctrl click or middle mouse click onto link */ + Arg a = {VB_TARGET_NEW}; + g_object_get(result, "link-uri", &a.s, NULL); + vb_load_uri(&a); + + propagate = true; + } + } else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) { mode_enter('i'); - propagate = true; - } else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK && event->button == 2) { - /* middle mouse click onto link */ - Arg a = {VB_TARGET_NEW}; - g_object_get(result, "link-uri", &a.s, NULL); - vb_load_uri(&a); - propagate = true; } g_object_unref(result);