aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
authorRyan Walklin <ryan@testtoast.com>2018-11-14 23:24:55 +0000
committerRyan Walklin <ryan@crackotage.local>2018-12-15 14:42:35 +1100
commit2a3c62b4d28ec7a69473e9c18c42f1ed26c74bbf (patch)
tree6284dc156f6edee6f22e8e5c97430da5f464c27c /backend/libinput/events.c
parent8a56b96c5516ee089b7561949aac4f83e5b94808 (diff)
[WIP][DONTMERGE]Add support for libinput_switch input devices
These are used primarily by laptops to signal the state of the lid (open/closed) and tablet mode if supported, based on ACPI events.
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;