1 /*
2  * This an unstable interface of wlroots. No guarantees are made regarding the
3  * future consistency of this API.
4  */
5 #ifndef WLR_USE_UNSTABLE
6 #error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
7 #endif
8 
9 #ifndef WLR_TYPES_WLR_INPUT_DEVICE_H
10 #define WLR_TYPES_WLR_INPUT_DEVICE_H
11 
12 enum wlr_button_state {
13 	WLR_BUTTON_RELEASED,
14 	WLR_BUTTON_PRESSED,
15 };
16 
17 enum wlr_input_device_type {
18 	WLR_INPUT_DEVICE_KEYBOARD,
19 	WLR_INPUT_DEVICE_POINTER,
20 	WLR_INPUT_DEVICE_TOUCH,
21 	WLR_INPUT_DEVICE_TABLET_TOOL,
22 	WLR_INPUT_DEVICE_TABLET_PAD,
23 	WLR_INPUT_DEVICE_SWITCH,
24 };
25 
26 /* Note: these are circular dependencies */
27 #include <wlr/types/wlr_keyboard.h>
28 #include <wlr/types/wlr_pointer.h>
29 #include <wlr/types/wlr_touch.h>
30 #include <wlr/types/wlr_tablet_tool.h>
31 #include <wlr/types/wlr_tablet_pad.h>
32 #include <wlr/types/wlr_switch.h>
33 
34 struct wlr_input_device_impl;
35 
36 struct wlr_input_device {
37 	const struct wlr_input_device_impl *impl;
38 
39 	enum wlr_input_device_type type;
40 	unsigned int vendor, product;
41 	char *name;
42 	// Or 0 if not applicable to this device
43 	double width_mm, height_mm;
44 	char *output_name;
45 
46 	/* wlr_input_device.type determines which of these is valid */
47 	union {
48 		void *_device;
49 		struct wlr_keyboard *keyboard;
50 		struct wlr_pointer *pointer;
51 		struct wlr_switch *switch_device;
52 		struct wlr_touch *touch;
53 		struct wlr_tablet *tablet;
54 		struct wlr_tablet_pad *tablet_pad;
55 	};
56 
57 	struct {
58 		struct wl_signal destroy;
59 	} events;
60 
61 	void *data;
62 
63 	struct wl_list link;
64 };
65 
66 #endif
67