From bdb402404cd6d54242b0b1dc2360cfc5679e52f2 Mon Sep 17 00:00:00 2001 From: Ryan Walklin Date: Wed, 20 Mar 2019 14:47:29 +1100 Subject: Support WLR_INPUT_DEVICE_SWITCH in sway This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch : Where is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events) --- include/sway/input/seat.h | 1 + include/sway/input/switch.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 include/sway/input/switch.h (limited to 'include/sway/input') diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index a5361e8c..f2af1066 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -27,6 +27,7 @@ struct sway_seat_device { struct sway_seat *sway_seat; struct sway_input_device *input_device; struct sway_keyboard *keyboard; + struct sway_switch *switch_device; struct wl_list link; // sway_seat::devices }; diff --git a/include/sway/input/switch.h b/include/sway/input/switch.h new file mode 100644 index 00000000..19bb1e77 --- /dev/null +++ b/include/sway/input/switch.h @@ -0,0 +1,19 @@ +#ifndef _SWAY_INPUT_SWITCH_H +#define _SWAY_INPUT_SWITCH_H + +#include "sway/input/seat.h" + +struct sway_switch { + struct sway_seat_device *seat_device; + + struct wl_listener switch_toggle; +}; + +struct sway_switch *sway_switch_create(struct sway_seat *seat, + struct sway_seat_device *device); + +void sway_switch_configure(struct sway_switch *sway_switch); + +void sway_switch_destroy(struct sway_switch *sway_switch); + +#endif -- cgit v1.2.3