summaryrefslogtreecommitdiff
path: root/clients/keyboard.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2014-01-07 12:57:59 -0800
committerKristian Høgsberg <krh@bitplanet.net>2014-01-07 12:57:59 -0800
commitef9c8eb2db49ff32788c1d9a4a88fd706017e045 (patch)
treef0f73f60ba4588eb87b868ddb7551d6d1bfc9d64 /clients/keyboard.c
parent966e3ed24770ebe3da9d88907cd404ab61b90fb7 (diff)
keyboard: Handle touch up event
This fixes arrow keys which trigger on button up. Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73169
Diffstat (limited to 'clients/keyboard.c')
-rw-r--r--clients/keyboard.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c
index 9ee4a848..e08a5fa6 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -625,11 +625,9 @@ button_handler(struct widget *widget,
}
static void
-touch_down_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
- float x, float y, void *data)
+touch_handler(struct input *input, uint32_t time,
+ float x, float y, uint32_t state, void *data)
{
-
struct keyboard *keyboard = data;
struct rectangle allocation;
int row, col;
@@ -648,20 +646,35 @@ touch_down_handler(struct widget *widget, struct input *input,
for (i = 0; i < layout->count; ++i) {
col -= layout->keys[i].width;
if (col < 0) {
- keyboard_handle_key(keyboard, time, &layout->keys[i], input, WL_POINTER_BUTTON_STATE_PRESSED);
+ keyboard_handle_key(keyboard, time,
+ &layout->keys[i], input, state);
break;
}
}
- widget_schedule_redraw(widget);
+ widget_schedule_redraw(keyboard->widget);
+}
+
+static void
+touch_down_handler(struct widget *widget, struct input *input,
+ uint32_t serial, uint32_t time, int32_t id,
+ float x, float y, void *data)
+{
+ touch_handler(input, time, x, y,
+ WL_POINTER_BUTTON_STATE_PRESSED, data);
}
static void
touch_up_handler(struct widget *widget, struct input *input,
- uint32_t serial, uint32_t time, int32_t id,
- void *data)
+ uint32_t serial, uint32_t time, int32_t id,
+ void *data)
{
+ float x, y;
+
+ input_get_touch(input, id, &x, &y);
+ touch_handler(input, time, x, y,
+ WL_POINTER_BUTTON_STATE_RELEASED, data);
}
static void
@@ -882,7 +895,6 @@ keyboard_create(struct output *output, struct virtual_keyboard *virtual_keyboard
widget_set_touch_down_handler(keyboard->widget, touch_down_handler);
widget_set_touch_up_handler(keyboard->widget, touch_up_handler);
-
window_schedule_resize(keyboard->window,
layout->columns * key_width,
layout->rows * key_height);