Permalink
Browse files

Merge pull request #77 from keis/fix-bad-click-context

set last_button before trying to get click context
  • Loading branch information...
bct committed Apr 3, 2012
2 parents dcb3b4e + 5d43248 commit 8af7c05ab0213029c0e5a0d015bbbcfe3f257e62
Showing with 9 additions and 7 deletions.
  1. +9 −7 src/callbacks.c
View
@@ -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++) {

0 comments on commit 8af7c05

Please sign in to comment.