diff options
Diffstat (limited to 'src/callbacks.c')
-rw-r--r-- | src/callbacks.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/callbacks.c b/src/callbacks.c index d3501b7..446e868 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -162,7 +162,6 @@ gboolean button_press_cb (GtkWidget* window, GdkEventButton* event) { (void) window; gint context; - gchar *details; gboolean propagate = FALSE, sendev = FALSE; @@ -178,6 +177,29 @@ button_press_cb (GtkWidget* window, GdkEventButton* event) { send_event(FORM_ACTIVE, NULL, TYPE_NAME, "button1", NULL); else if((context & WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)) send_event(ROOT_ACTIVE, NULL, TYPE_NAME, "button1", NULL); + else { + sendev = TRUE; + propagate = TRUE; + } + } + else if(event->button == 2 && !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)) { + sendev = TRUE; + propagate = TRUE; + } + else if(event->button > 3) { + sendev = TRUE; + propagate = TRUE; + } + + if(sendev) { + button_to_event(event->button, event->state, GDK_BUTTON_PRESS); + } + } + + 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; } else if(event->button == 2 && !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)) { sendev = TRUE; @@ -189,9 +211,7 @@ button_press_cb (GtkWidget* window, GdkEventButton* event) { } if(sendev) { - details = g_strdup_printf("Button%d", event->button); - send_event(KEY_PRESS, NULL, TYPE_NAME, details, NULL); - g_free (details); + button_to_event(event->button, event->state, event->type); } } @@ -202,7 +222,6 @@ gboolean button_release_cb (GtkWidget* window, GdkEventButton* event) { (void) window; gint context; - gchar *details; gboolean propagate = FALSE, sendev = FALSE; @@ -218,9 +237,7 @@ button_release_cb (GtkWidget* window, GdkEventButton* event) { } if(sendev) { - details = g_strdup_printf("Button%d", event->button); - send_event(KEY_RELEASE, NULL, TYPE_NAME, details, NULL); - g_free (details); + button_to_event(event->button, event->state, GDK_BUTTON_RELEASE); } } |