aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ben Boeckel <MathStuf@gmail.com>2011-04-21 13:42:02 -0400
committerGravatar keis <keijser@gmail.com>2011-04-23 13:58:54 +0200
commit24884399671da9da0889809a5ca04ce04eadb72d (patch)
treee5df53cab685b5e4fc30e7e868df59022a6e4d21
parent02fcc0f6527353baf8f376ed6651cfe7c77bf15b (diff)
Add key events for double and triple clicks
-rw-r--r--src/callbacks.c19
-rw-r--r--src/events.c15
2 files changed, 33 insertions, 1 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 5873b5e..33c9766 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -598,6 +598,25 @@ button_press_cb (GtkWidget* window, GdkEventButton* event) {
}
}
+ if(event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
+ if(event->button == 1) {
+ 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, event->type);
+ }
+ }
+
return propagate;
}
diff --git a/src/events.c b/src/events.c
index 0ae7a98..3074b34 100644
--- a/src/events.c
+++ b/src/events.c
@@ -310,12 +310,25 @@ key_to_event(guint keyval, guint state, guint is_modifier, gint mode) {
void
button_to_event(guint buttonval, guint state, gint mode) {
gchar *details;
+ const char *reps;
gchar *modifiers = NULL;
/* Get modifier state */
modifiers = get_modifier_mask(state);
- details = g_strdup_printf("Button%d", buttonval);
+ switch (mode) {
+ case GDK_2BUTTON_PRESS:
+ reps = "2";
+ break;
+ case GDK_3BUTTON_PRESS:
+ reps = "3";
+ break;
+ default:
+ reps = "";
+ break;
+ }
+
+ details = g_strdup_printf("%sButton%d", reps, buttonval);
send_event(mode == GDK_BUTTON_PRESS ? KEY_PRESS : KEY_RELEASE, NULL,
TYPE_STR, modifiers, TYPE_FORMATTEDSTR, details, NULL);