commit a8ecc3d

Frantisek Fladung  ·  2017-03-21 09:18:29 +0000 UTC
parent ed115d7
add new_device to swc manager
2 files changed,  +10, -1
+2, -0
1@@ -255,6 +255,8 @@ handle_libinput_data(int fd, uint32_t mask, void *data)
2 		case LIBINPUT_EVENT_DEVICE_ADDED:
3 			device = libinput_event_get_device(generic_event);
4 			update_capabilities(device_capabilities(device));
5+			if (swc.manager->new_device)
6+				swc.manager->new_device(device);
7 			break;
8 		case LIBINPUT_EVENT_KEYBOARD_KEY:
9 			event.k = libinput_event_get_keyboard_event(generic_event);
+8, -1
 1@@ -32,6 +32,8 @@
 2 extern "C" {
 3 #endif
 4 
 5+struct libinput_device;
 6+
 7 /* Rectangles {{{ */
 8 
 9 struct swc_rectangle {
10@@ -293,7 +295,7 @@ int swc_add_binding(enum swc_binding_type type, uint32_t modifiers, uint32_t val
11 
12 /**
13  * This is a user-provided structure that swc will use to notify the display
14- * server of new windows and screens.
15+ * server of new windows, screens and input devices.
16  */
17 struct swc_manager {
18 	/**
19@@ -306,6 +308,11 @@ struct swc_manager {
20 	 */
21 	void (*new_window)(struct swc_window *window);
22 
23+	/**
24+	 * Called when a new input device is detected.
25+	 */
26+	void (*new_device)(struct libinput_device *device);
27+
28 	/**
29 	 * Called when the session gets activated (for example, startup or VT switch).
30 	 */