aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2012-04-02 18:36:30 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2012-04-02 18:36:30 -0700
commit8af7c05ab0213029c0e5a0d015bbbcfe3f257e62 (patch)
tree1a1fd64dbe8f6d8cbf65e9d37c272725ab7df6f0
parentdcb3b4e1fcff682b412cfe5875f7054b97380d08 (diff)
parent5d432487440d5d2b0f97f83c3ee759a9d8d4219b (diff)
Merge pull request #77 from keis/fix-bad-click-context
set last_button before trying to get click context
-rw-r--r--src/callbacks.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 23b8d55..04bc2c3 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -165,13 +165,15 @@ button_press_cb (GtkWidget* window, GdkEventButton* event) {
gboolean propagate = FALSE,
sendev = FALSE;
- context = get_click_context(NULL);
+ // Save last button click for use in menu
+ if(uzbl.state.last_button)
+ gdk_event_free((GdkEvent *)uzbl.state.last_button);
+ uzbl.state.last_button = (GdkEventButton *)gdk_event_copy((GdkEvent *)event);
- if(event->type == GDK_BUTTON_PRESS) {
- if(uzbl.state.last_button)
- gdk_event_free((GdkEvent *)uzbl.state.last_button);
- uzbl.state.last_button = (GdkEventButton *)gdk_event_copy((GdkEvent *)event);
+ // Grab context from last click
+ context = get_click_context();
+ if(event->type == GDK_BUTTON_PRESS) {
/* left click */
if(event->button == 1) {
if((context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))
@@ -226,7 +228,7 @@ button_release_cb (GtkWidget* window, GdkEventButton* event) {
gboolean propagate = FALSE,
sendev = FALSE;
- context = get_click_context(NULL);
+ context = get_click_context();
if(event->type == GDK_BUTTON_RELEASE) {
if(event->button == 2 && !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)) {
sendev = TRUE;
@@ -624,7 +626,7 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) {
return;
/* check context */
- if((context = get_click_context(NULL)) == -1)
+ if((context = get_click_context()) == -1)
return;
for(i=0; i < uzbl.gui.menu_items->len; i++) {