2018-11-15 00:24:55 +01:00
|
|
|
/*
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
* future consistency of this API.
|
|
|
|
*/
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WLR_TYPES_WLR_SWITCH_H
|
|
|
|
#define WLR_TYPES_WLR_SWITCH_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2018-11-15 00:24:55 +01:00
|
|
|
#include <wlr/types/wlr_input_device.h>
|
|
|
|
|
|
|
|
struct wlr_switch_impl;
|
|
|
|
|
|
|
|
struct wlr_switch {
|
2022-01-31 16:53:58 +01:00
|
|
|
struct wlr_input_device base;
|
|
|
|
|
2022-02-09 21:53:42 +01:00
|
|
|
const struct wlr_switch_impl *impl;
|
2018-11-15 00:24:55 +01:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal toggle;
|
|
|
|
} events;
|
|
|
|
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wlr_switch_type {
|
2022-03-09 21:08:20 +01:00
|
|
|
WLR_SWITCH_TYPE_LID,
|
2018-11-15 00:24:55 +01:00
|
|
|
WLR_SWITCH_TYPE_TABLET_MODE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wlr_switch_state {
|
|
|
|
WLR_SWITCH_STATE_OFF = 0,
|
2022-03-09 21:08:20 +01:00
|
|
|
WLR_SWITCH_STATE_ON,
|
2018-11-15 00:24:55 +01:00
|
|
|
};
|
|
|
|
|
2022-03-09 21:08:20 +01:00
|
|
|
struct wlr_switch_toggle_event {
|
2018-11-15 00:24:55 +01:00
|
|
|
uint32_t time_msec;
|
|
|
|
enum wlr_switch_type switch_type;
|
|
|
|
enum wlr_switch_state switch_state;
|
|
|
|
};
|
|
|
|
|
2022-06-20 16:57:29 +02:00
|
|
|
/**
|
|
|
|
* Get a struct wlr_switch from a struct wlr_input_device.
|
|
|
|
*
|
|
|
|
* Asserts that the input device is a switch.
|
|
|
|
*/
|
|
|
|
struct wlr_switch *wlr_switch_from_input_device(
|
|
|
|
struct wlr_input_device *input_device);
|
|
|
|
|
2018-11-15 00:24:55 +01:00
|
|
|
#endif
|