keyboard: Handle touch up event

This fixes arrow keys which trigger on button up.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73169
diff --git a/clients/keyboard.c b/clients/keyboard.c
index 9ee4a84..e08a5fa 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -625,11 +625,9 @@
 }
 
 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 @@
 	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 @@
 	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);
diff --git a/clients/window.c b/clients/window.c
index d586244..be89b64 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -289,6 +289,7 @@
 
 struct touch_point {
 	int32_t id;
+	float x, y;
 	struct widget *widget;
 	struct wl_list link;
 };
@@ -3019,6 +3020,8 @@
 		if (tp) {
 			tp->id = id;
 			tp->widget = widget;
+			tp->x = sx;
+			tp->y = sy;
 			wl_list_insert(&input->touch_point_list, &tp->link);
 
 			if (widget->touch_down_handler)
@@ -3078,6 +3081,8 @@
 		if (tp->id != id)
 			continue;
 
+		tp->x = sx;
+		tp->y = sy;
 		if (tp->widget->touch_motion_handler)
 			(*tp->widget->touch_motion_handler)(tp->widget, input, time,
 							    id, sx, sy,
@@ -3195,6 +3200,23 @@
 	*y = input->sy;
 }
 
+int
+input_get_touch(struct input *input, int32_t id, float *x, float *y)
+{
+	struct touch_point *tp;
+
+	wl_list_for_each(tp, &input->touch_point_list, link) {
+		if (tp->id != id)
+			continue;
+
+		*x = tp->x;
+		*y = tp->y;
+		return 0;
+	}
+
+	return -1;
+}
+
 struct display *
 input_get_display(struct input *input)
 {
diff --git a/clients/window.h b/clients/window.h
index cf8fc6c..57ff87b 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -521,6 +521,9 @@
 void
 input_get_position(struct input *input, int32_t *x, int32_t *y);
 
+int
+input_get_touch(struct input *input, int32_t id, float *x, float *y);
+
 #define MOD_SHIFT_MASK		0x01
 #define MOD_ALT_MASK		0x02
 #define MOD_CONTROL_MASK	0x04