drm: Add vt switch keybindings
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 763ffc8..8bbf867 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <linux/input.h>
 
 #include <xf86drm.h>
 #include <xf86drmMode.h>
@@ -1542,6 +1543,16 @@
 	};
 }
 
+static void
+switch_vt_binding(struct wl_input_device *device, uint32_t time,
+		  uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data)
+{
+	struct drm_compositor *ec = data;
+
+	if (state)
+		tty_activate_vt(ec->tty, key - KEY_F1 + 1);
+}
+
 static const char default_seat[] = "seat0";
 
 static struct weston_compositor *
@@ -1554,6 +1565,7 @@
 	struct udev_device *device, *drm_device;
 	const char *path, *device_seat;
 	struct wl_event_loop *loop;
+	uint32_t key;
 
 	ec = malloc(sizeof *ec);
 	if (ec == NULL)
@@ -1614,6 +1626,11 @@
 	if (weston_compositor_init(&ec->base, display) < 0)
 		return NULL;
 
+	for (key = KEY_F1; key < KEY_F9; key++)
+		weston_compositor_add_binding(&ec->base, key, 0, 0,
+					      MODIFIER_CTRL | MODIFIER_ALT,
+					      switch_vt_binding, ec);
+
 	wl_list_init(&ec->sprite_list);
 	create_sprites(ec);