[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.
This commit is contained in:
Ryan Walklin 2018-11-14 23:24:55 +00:00 committed by Ryan Walklin
parent 8a56b96c55
commit 2a3c62b4d2
18 changed files with 261 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include <wlr/interfaces/wlr_tablet_pad.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/interfaces/wlr_switch.h>
#include <wlr/util/log.h>
#include "backend/headless.h"
#include "util/signal.h"
@ -76,6 +77,13 @@ struct wlr_input_device *wlr_headless_add_input_device(
}
wlr_tablet_pad_init(wlr_device->tablet_pad, NULL);
break;
case WLR_INPUT_DEVICE_SWITCH:
wlr_device->lid_switch = calloc(1, sizeof(struct wlr_switch));
if (wlr_device->lid_switch == NULL) {
wlr_log(WLR_ERROR, "Unable to allocate wlr_switch");
goto error;
}
wlr_switch_init(wlr_device->lid_switch, NULL);
}
wl_list_insert(&backend->input_devices, &wlr_device->link);