commit a8ecc3d599d92028882d80010cd1b582e061df44
parent ed115d7384473b83446d6393f4539e5d63a1b093
Author: Frantisek Fladung <ametisf@gmail.com>
Date: Tue, 21 Mar 2017 10:18:29 +0100
add new_device to swc manager
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/libswc/seat.c b/libswc/seat.c
@@ -255,6 +255,8 @@ handle_libinput_data(int fd, uint32_t mask, void *data)
case LIBINPUT_EVENT_DEVICE_ADDED:
device = libinput_event_get_device(generic_event);
update_capabilities(device_capabilities(device));
+ if (swc.manager->new_device)
+ swc.manager->new_device(device);
break;
case LIBINPUT_EVENT_KEYBOARD_KEY:
event.k = libinput_event_get_keyboard_event(generic_event);
diff --git a/libswc/swc.h b/libswc/swc.h
@@ -32,6 +32,8 @@
extern "C" {
#endif
+struct libinput_device;
+
/* Rectangles {{{ */
struct swc_rectangle {
@@ -293,7 +295,7 @@ int swc_add_binding(enum swc_binding_type type, uint32_t modifiers, uint32_t val
/**
* This is a user-provided structure that swc will use to notify the display
- * server of new windows and screens.
+ * server of new windows, screens and input devices.
*/
struct swc_manager {
/**
@@ -307,6 +309,11 @@ struct swc_manager {
void (*new_window)(struct swc_window *window);
/**
+ * Called when a new input device is detected.
+ */
+ void (*new_device)(struct libinput_device *device);
+
+ /**
* Called when the session gets activated (for example, startup or VT switch).
*/
void (*activate)();