Add a touch binding to activate a surface

Adds a new binding type for touch events via the new function
weston_compositor_add_touch_binding. The binding can only be added for
a touch down with the first finger. The shell now uses this to install
a binding to activate the current surface.
diff --git a/src/shell.c b/src/shell.c
index f033e8c..4a0c122 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3124,15 +3124,12 @@
 }
 
 static void
-click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
-			  void *data)
+activate_binding(struct weston_seat *seat,
+		 struct desktop_shell *shell,
+		 struct weston_surface *focus)
 {
-	struct weston_seat *ws = (struct weston_seat *) seat;
-	struct desktop_shell *shell = data;
-	struct weston_surface *focus;
 	struct weston_surface *main_surface;
 
-	focus = (struct weston_surface *) seat->pointer->focus;
 	if (!focus)
 		return;
 
@@ -3143,8 +3140,28 @@
 	if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
 		return;
 
-	if (seat->pointer->grab == &seat->pointer->default_grab)
-		activate(shell, focus, ws);
+	activate(shell, focus, seat);
+}
+
+static void
+click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
+			  void *data)
+{
+	if (seat->pointer->grab != &seat->pointer->default_grab)
+		return;
+
+	activate_binding(seat, data,
+			 (struct weston_surface *) seat->pointer->focus);
+}
+
+static void
+touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data)
+{
+	if (seat->touch->grab != &seat->touch->default_grab)
+		return;
+
+	activate_binding(seat, data,
+			 (struct weston_surface *) seat->touch->focus);
 }
 
 static void
@@ -4496,6 +4513,9 @@
 	weston_compositor_add_button_binding(ec, BTN_LEFT, 0,
 					     click_to_activate_binding,
 					     shell);
+	weston_compositor_add_touch_binding(ec, 0,
+					    touch_to_activate_binding,
+					    shell);
 	weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL,
 				           MODIFIER_SUPER | MODIFIER_ALT,
 				           surface_opacity_binding, NULL);