diff options
-rw-r--r-- | src/callback.c | 2 | ||||
-rw-r--r-- | src/dwb.c | 12 | ||||
-rw-r--r-- | src/dwb.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/callback.c b/src/callback.c index e62a435c..657632af 100644 --- a/src/callback.c +++ b/src/callback.c @@ -174,7 +174,7 @@ callback_key_press(GtkWidget *w, GdkEventKey *e) else if (gtk_widget_has_focus(dwb.gui.entry) || mode & COMPLETION_MODE) ret = false; else if (webkit_web_view_has_selection(CURRENT_WEBVIEW()) && e->keyval == GDK_KEY_Return) - dwb_follow_selection(); + dwb_follow_selection(e); else if (dwb.state.mode & AUTO_COMPLETE && DWB_TAB_KEY(e)) { completion_autocomplete(dwb.keymap, e); @@ -1240,7 +1240,7 @@ dwb_sync_files(gpointer data) /* dwb_follow_selection() {{{*/ void -dwb_follow_selection() +dwb_follow_selection(GdkEventKey *e) { char *href = NULL; WebKitDOMNode *n = NULL, *tmp; @@ -1257,9 +1257,15 @@ dwb_follow_selection() WebKitDOMNode *document_element = WEBKIT_DOM_NODE(webkit_dom_document_get_document_element(doc)); n = webkit_dom_range_get_start_container(range, NULL); - while( n && n != document_element && href == NULL) { - if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(n)) { + while( n && n != document_element && href == NULL) + { + if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(n)) + { href = webkit_dom_html_anchor_element_get_href(WEBKIT_DOM_HTML_ANCHOR_ELEMENT(n)); + if (e->state & GDK_CONTROL_MASK) + dwb.state.nv = OPEN_NEW_VIEW; + else if (e->state & GDK_SHIFT_MASK) + dwb.state.nv = OPEN_BACKGROUND | OPEN_NEW_VIEW; dwb_load_uri(dwb.state.fview, href); } tmp = n; @@ -963,7 +963,7 @@ void dwb_set_hsts(GList *, WebSettings *); gboolean dwb_eval_key(GdkEventKey *); gboolean dwb_eval_override_key(GdkEventKey *e, CommandProperty prop); char * dwb_get_key(GdkEventKey *, unsigned int *, gboolean *); -void dwb_follow_selection(void); +void dwb_follow_selection(GdkEventKey *); void dwb_update_layout(void); const char * dwb_parse_nummod(const char *); void dwb_init_custom_keys(gboolean); |