aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-12-15 19:54:25 +0100
committerGitHub <noreply@github.com>2018-12-15 19:54:25 +0100
commit6d4bfa3226123e958ff2bdc4f226489cba49f84d (patch)
tree256c7c3ded68d4b95ed09f7a2fbfd5bc67dbcee9 /backend/libinput/events.c
parent8a56b96c5516ee089b7561949aac4f83e5b94808 (diff)
parentf8129ecbc5147a62d93d6bac5e61e5ce79d89667 (diff)
Merge pull request #1377 from tokyovigilante/switch-events
Add support for libinput_switch input devices
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;