diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2012-03-09 19:43:28 -0500 |
---|---|---|
committer | Ben Boeckel <mathstuf@gmail.com> | 2012-03-09 19:47:10 -0500 |
commit | a2cca9828f17a6133ba6214a7e460eb31f8b8418 (patch) | |
tree | 526ee663533f6c6b1653acca9954c73abacc4e97 | |
parent | df7ec7dce93ddb129087422ddf3de4dc876af0c7 (diff) |
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.
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | src/callbacks.c | 8 | ||||
-rw-r--r-- | src/uzbl-core.h | 1 | ||||
-rw-r--r-- | src/variables.c | 2 |
4 files changed, 10 insertions, 4 deletions
@@ -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)}, |