From 0a93c981821ba37765f271d87d6788370da5e409 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 16 Feb 2010 01:51:13 -0500 Subject: Open links in new windows with control+shift+click This should restore the old behaviour of modifiers completely. Bug #604950 --- src/ephy-window.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/ephy-window.c b/src/ephy-window.c index bc42ff3c3..91f99307a 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2502,11 +2502,30 @@ policy_decision_required_cb (WebKitWebView *web_view, return TRUE; } - /* Open in new tab for middle click or ctrl+click */ - if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED && - (button == 2 /* middle button */ || - (button == 1 && state == GDK_CONTROL_MASK) /* ctrl + left button */)) { + if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { EphyEmbed *embed; + EphyNewTabFlags flags; + + flags = EPHY_NEW_TAB_OPEN_PAGE; + + /* New tab in new window for control+shift+click */ + if (button == 1 && + state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) + { + flags |= EPHY_NEW_TAB_IN_NEW_WINDOW; + } + /* New tab in existing window for middle click and + * control+click */ + else if (button == 2 || + (button == 1 && state == GDK_CONTROL_MASK)) + { + flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW; + } + /* Those were our special cases, we won't handle this */ + else + { + return FALSE; + } embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); @@ -2515,8 +2534,7 @@ policy_decision_required_cb (WebKitWebView *web_view, window, embed, request, - EPHY_NEW_TAB_IN_EXISTING_WINDOW | - EPHY_NEW_TAB_OPEN_PAGE, + flags, EPHY_WEB_VIEW_CHROME_ALL, FALSE, 0); return TRUE; -- cgit v1.2.3