diff options
author | portix <none@none> | 2012-11-05 21:23:18 +0100 |
---|---|---|
committer | portix <none@none> | 2012-11-05 21:23:18 +0100 |
commit | 773dbe7055f3c10ac2329803647fba405ac7cff8 (patch) | |
tree | a1f1fb536d9e0c4a2425d23106d1b98e06252591 /src | |
parent | 46af32e61b13c8e31987592630e00ec954f41147 (diff) | |
download | dwb-773dbe7055f3c10ac2329803647fba405ac7cff8.zip |
Ignore default action of button 8 and button 9
Diffstat (limited to 'src')
-rw-r--r-- | src/scripts.c | 2 | ||||
-rw-r--r-- | src/view.c | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/scripts.c b/src/scripts.c index 7bfb84df..2cde4e94 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -738,7 +738,7 @@ global_bind(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size Key key = dwb_str_to_key(keystr); map->key = key.str; map->mod = key.mod; - FunctionMap fm = { { name, callback }, option, (Func)scripts_eval_key, NULL, POST_SM, { .arg = func }, EP_NONE, {NULL} }; + FunctionMap fm = { { name, callback }, option, (Func)scripts_eval_key, NULL, NEVER_SM, { .arg = func }, EP_NONE, {NULL} }; *fmap = fm; map->map = fmap; dwb.keymap = g_list_prepend(dwb.keymap, map); @@ -170,10 +170,11 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) { webkit_dom_dom_selection_add_range(selection, range); m_sig_caret_button_release = g_signal_connect(web, "button-release-event", G_CALLBACK(view_caret_release_cb), range); m_sig_caret_motion = g_signal_connect(web, "motion-notify-event", G_CALLBACK(view_caret_motion_cb), range); - ret = true; + return false; } else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION && e->type == GDK_BUTTON_PRESS && e->state & GDK_BUTTON1_MASK) { char *clipboard = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY)); + char *backup = clipboard; g_strstrip(clipboard); if (e->button == 3) { dwb_load_uri(NULL, clipboard); @@ -183,7 +184,8 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) { view_add(clipboard, dwb.state.background_tabs); ret = true; } - g_free(clipboard); + g_free(backup); + return ret; } else if (e->button == 1 && e->type == GDK_BUTTON_PRESS && WEBVIEW(gl) != CURRENT_WEBVIEW()) { dwb_unfocus(); @@ -191,13 +193,15 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) { } else if (e->button == 3 && e->state & GDK_BUTTON1_MASK) { /* no popup if button 1 is presssed */ - ret = true; + return true; } else if (e->button == 8) { dwb_history_back(); + return true; } else if (e->button == 9) { dwb_history_forward(); + return true; } return ret; }/*}}}*/ |