diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/libinput.h | 11 | ||||
-rw-r--r-- | include/types.h | 8 | ||||
-rw-r--r-- | include/wlr/types.h | 80 |
3 files changed, 96 insertions, 3 deletions
diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 2427ae5c..80f57177 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -57,4 +57,15 @@ void handle_touch_motion(struct libinput_event *event, void handle_touch_cancel(struct libinput_event *event, struct libinput_device *device); +struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( + struct libinput_device *device); +void handle_tablet_tool_axis(struct libinput_event *event, + struct libinput_device *device); +void handle_tablet_tool_proximity(struct libinput_event *event, + struct libinput_device *device); +void handle_tablet_tool_tip(struct libinput_event *event, + struct libinput_device *device); +void handle_tablet_tool_button(struct libinput_event *event, + struct libinput_device *device); + #endif diff --git a/include/types.h b/include/types.h index 5b20e2ed..efead03c 100644 --- a/include/types.h +++ b/include/types.h @@ -42,6 +42,14 @@ struct wlr_touch *wlr_touch_create(struct wlr_touch_impl *impl, struct wlr_touch_state *state); void wlr_touch_destroy(struct wlr_touch *touch); +struct wlr_tablet_tool_impl { + void (*destroy)(struct wlr_tablet_tool_state *tool); +}; + +struct wlr_tablet_tool *wlr_tablet_tool_create(struct wlr_tablet_tool_impl *impl, + struct wlr_tablet_tool_state *state); +void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool); + struct wlr_input_device_impl { void (*destroy)(struct wlr_input_device_state *state); }; diff --git a/include/wlr/types.h b/include/wlr/types.h index 4763013a..aae76f06 100644 --- a/include/wlr/types.h +++ b/include/wlr/types.h @@ -177,15 +177,88 @@ struct wlr_touch_cancel { int32_t slot; }; -// TODO: tablet & tablet tool -// TODO: gestures +struct wlr_tablet_tool_impl; +struct wlr_tablet_tool_state; + +struct wlr_tablet_tool { + struct wlr_tablet_tool_impl *impl; + struct wlr_tablet_tool_state *state; + + struct { + struct wl_signal axis; + struct wl_signal proximity; + struct wl_signal tip; + struct wl_signal button; + } events; +}; + +enum wlr_tablet_tool_axes { + WLR_TABLET_TOOL_AXIS_X = 1, + WLR_TABLET_TOOL_AXIS_Y = 2, + WLR_TABLET_TOOL_AXIS_DISTANCE = 4, + WLR_TABLET_TOOL_AXIS_PRESSURE = 8, + WLR_TABLET_TOOL_AXIS_TILT_X = 16, + WLR_TABLET_TOOL_AXIS_TILT_Y = 32, + WLR_TABLET_TOOL_AXIS_ROTATION = 64, + WLR_TABLET_TOOL_AXIS_SLIDER = 128, + WLR_TABLET_TOOL_AXIS_WHEEL = 256, +}; + +struct wlr_tablet_tool_axis { + uint32_t time_sec; + uint64_t time_usec; + uint32_t updated_axes; + double x_mm, y_mm; + double width_mm, height_mm; + double pressure; + double distance; + double tilt_x, tilt_y; + double rotation; + double slider; + double wheel_delta; +}; + +enum wlr_tablet_tool_proximity_state { + WLR_TABLET_TOOL_PROXIMITY_OUT, + WLR_TABLET_TOOL_PROXIMITY_IN, +}; + +struct wlr_tablet_tool_proximity { + uint32_t time_sec; + uint64_t time_usec; + double x, y; + double width_mm, height_mm; + enum wlr_tablet_tool_proximity_state state; +}; + +enum wlr_tablet_tool_tip_state { + WLR_TABLET_TOOL_TIP_UP, + WLR_TABLET_TOOL_TIP_DOWN, +}; + +struct wlr_tablet_tool_tip { + uint32_t time_sec; + uint64_t time_usec; + double x, y; + double width_mm, height_mm; + enum wlr_tablet_tool_tip_state state; +}; + +struct wlr_tablet_tool_button { + uint32_t time_sec; + uint64_t time_usec; + uint32_t button; + enum wlr_button_state state; +}; + +// TODO: tablet pad // TODO: switch enum wlr_input_device_type { WLR_INPUT_DEVICE_KEYBOARD, WLR_INPUT_DEVICE_POINTER, WLR_INPUT_DEVICE_TOUCH, - WLR_INPUT_DEVICE_TABLET_PEN, + WLR_INPUT_DEVICE_TABLET_TOOL, WLR_INPUT_DEVICE_TABLET_PAD, WLR_INPUT_DEVICE_GESTURE, WLR_INPUT_DEVICE_SWITCH, @@ -207,6 +280,7 @@ struct wlr_input_device { struct wlr_keyboard *keyboard; struct wlr_pointer *pointer; struct wlr_touch *touch; + struct wlr_tablet_tool *tablet_tool; }; }; |