From a2cca9828f17a6133ba6214a7e460eb31f8b8418 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 9 Mar 2012 19:43:28 -0500 Subject: Add a variable to mediate multiple button clicks The keyevent is always sent for multiple clicks (that aren't in an edit field for left and middle clicks), but the propogation of the event through to webkit can be suppressed if the user wants something else to happen. This allows double and triple click selections (by word and paragraph, respectively) work again. --- README | 3 +++ src/callbacks.c | 8 ++++---- src/uzbl-core.h | 1 + src/variables.c | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README b/README index 928a7bd..b124fb4 100644 --- a/README +++ b/README @@ -373,6 +373,9 @@ file). access the contents of other `file://` URIs. (default 0). * `follow_hint_keys`: keys for keyboard-based navigation and link highlighting +* `handle_multi_click`: If set to 1, event handlers attached to `2Button*` + and `3Button*` bindings will only be used instead of the default actions in + WebKit (default 0). * `ssl_ca_file`: File that contains CA certificates. * `ssl_verify`: If set to 1, uzbl won't connect to "https" url unless it can validate certificate presented by remote server against `ssl_ca_file`. diff --git a/src/callbacks.c b/src/callbacks.c index 4e9544d..0a0d45a 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -196,15 +196,15 @@ button_press_cb (GtkWidget* window, GdkEventButton* event) { if(event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) { if(event->button == 1 && !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) && (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)) { sendev = TRUE; - propagate = TRUE; + propagate = uzbl.state.handle_multi_button; } else if(event->button == 2 && !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)) { sendev = TRUE; - propagate = TRUE; + propagate = uzbl.state.handle_multi_button; } - else if(event->button > 3) { + else if(event->button >= 3) { sendev = TRUE; - propagate = TRUE; + propagate = uzbl.state.handle_multi_button; } } diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 29b7b64..84ccfa0 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -113,6 +113,7 @@ typedef struct { /* Events */ int socket_id; gboolean events_stdout; + gboolean handle_multi_button; GPtrArray* event_buffer; gchar** connect_socket_names; } State; diff --git a/src/variables.c b/src/variables.c index 8d874c2..e4763bc 100644 --- a/src/variables.c +++ b/src/variables.c @@ -735,6 +735,8 @@ const struct var_name_to_ptr_t { { "verbose", PTR_V_INT(uzbl.state.verbose, 1, NULL)}, { "print_events", PTR_V_INT(uzbl.state.events_stdout, 1, NULL)}, + { "handle_multi_button", PTR_V_INT(uzbl.state.handle_multi_button, 1, NULL)}, + { "show_status", PTR_V_INT_GETSET(show_status)}, { "status_top", PTR_V_INT(uzbl.behave.status_top, 1, set_status_top)}, { "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)}, -- cgit v1.2.3