editor: Add missing touch-to-activate for the entries

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72996
diff --git a/clients/editor.c b/clients/editor.c
index b34aafa..76e2346 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -115,6 +115,9 @@
 				      struct input *input, uint32_t time,
 				      uint32_t button,
 				      enum wl_pointer_button_state state, void *data);
+static void text_entry_touch_handler(struct widget *widget, struct input *input,
+				     uint32_t serial, uint32_t time, int32_t id,
+				     float tx, float ty, void *data);
 static int text_entry_motion_handler(struct widget *widget,
 				     struct input *input, uint32_t time,
 				     float x, float y, void *data);
@@ -516,6 +519,7 @@
 	widget_set_redraw_handler(entry->widget, text_entry_redraw_handler);
 	widget_set_button_handler(entry->widget, text_entry_button_handler);
 	widget_set_motion_handler(entry->widget, text_entry_motion_handler);
+	widget_set_touch_down_handler(entry->widget, text_entry_touch_handler);
 
 	return entry;
 }
@@ -1078,6 +1082,29 @@
 }
 
 static void
+text_entry_touch_handler(struct widget *widget, struct input *input,
+			 uint32_t serial, uint32_t time, int32_t id,
+			 float tx, float ty, void *data)
+{
+	struct text_entry *entry = data;
+	struct wl_seat *seat = input_get_seat(input);
+	struct rectangle allocation;
+	struct editor *editor;
+	int32_t x, y;
+
+	widget_get_allocation(entry->widget, &allocation);
+
+	x = tx - (allocation.x + text_offset_left);
+	y = ty - (allocation.y + text_offset_left);
+
+	editor = window_get_user_data(entry->window);
+	text_entry_activate(entry, seat);
+	editor->active_entry = entry;
+
+	text_entry_set_cursor_position(entry, x, y, true);
+}
+
+static void
 editor_button_handler(struct widget *widget,
 		      struct input *input, uint32_t time,
 		      uint32_t button,
@@ -1098,6 +1125,19 @@
 	}
 }
 
+static void
+editor_touch_handler(struct widget *widget, struct input *input,
+		     uint32_t serial, uint32_t time, int32_t id,
+		     float tx, float ty, void *data)
+{
+	struct editor *editor = data;
+
+	struct wl_seat *seat = input_get_seat(input);
+
+	text_entry_deactivate(editor->entry, seat);
+	text_entry_deactivate(editor->editor, seat);
+	editor->active_entry = NULL;
+}
 
 static void
 keyboard_focus_handler(struct window *window,
@@ -1250,6 +1290,7 @@
 	widget_set_redraw_handler(editor.widget, redraw_handler);
 	widget_set_resize_handler(editor.widget, resize_handler);
 	widget_set_button_handler(editor.widget, editor_button_handler);
+	widget_set_touch_down_handler(editor.widget, editor_touch_handler);
 
 	window_schedule_resize(editor.window, 500, 400);