aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput/events.c')
-rw-r--r--backend/libinput/events.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 9ce62d6f..a7a6c114 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -169,7 +169,17 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
}
if (libinput_device_has_capability(
libinput_dev, LIBINPUT_DEVICE_CAP_SWITCH)) {
- // TODO
+ struct wlr_input_device *wlr_dev = allocate_device(backend,
+ libinput_dev, wlr_devices, WLR_INPUT_DEVICE_SWITCH);
+ if (!wlr_dev) {
+ goto fail;
+ }
+ wlr_dev->lid_switch = create_libinput_switch(libinput_dev);
+ if (!wlr_dev->lid_switch) {
+ free(wlr_dev);
+ goto fail;
+ }
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (!wl_list_empty(wlr_devices)) {
@@ -274,6 +284,9 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
case LIBINPUT_EVENT_TABLET_PAD_STRIP:
handle_tablet_pad_strip(event, libinput_dev);
break;
+ case LIBINPUT_EVENT_SWITCH_TOGGLE:
+ handle_switch_toggle(event, libinput_dev);
+ break;
default:
wlr_log(WLR_DEBUG, "Unknown libinput event %d", event_type);
break;