diff options
author | John Chadwick <johnwchadwick@gmail.com> | 2019-09-17 21:46:29 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-09-25 23:10:33 -0400 |
commit | 7e420cb6e4a334dea7296060820de12a768b76da (patch) | |
tree | 143678e6ff0a4b4223e2dfe30086eb5e2d2ab174 /include/sway/input | |
parent | 875edc9c2f497cee2f26042b1cffc8c3495721f8 (diff) |
input: Add support for tablet protocol.
Sway has basic support for drawing tablets, but does not expose
properties such as pressure sensitivity. This implements the wlr tablet
v2 protocol, providing tablet events to Wayland clients.
Diffstat (limited to 'include/sway/input')
-rw-r--r-- | include/sway/input/cursor.h | 3 | ||||
-rw-r--r-- | include/sway/input/seat.h | 2 | ||||
-rw-r--r-- | include/sway/input/tablet.h | 62 |
3 files changed, 67 insertions, 0 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 516718c9..e46c9b18 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h @@ -21,6 +21,8 @@ struct sway_cursor { struct sway_node *node; } previous; struct wlr_xcursor_manager *xcursor_manager; + struct wl_list tablets; + struct wl_list tablet_pads; const char *image; struct wl_client *image_client; @@ -42,6 +44,7 @@ struct sway_cursor { struct wl_listener tool_axis; struct wl_listener tool_tip; + struct wl_listener tool_proximity; struct wl_listener tool_button; uint32_t tool_buttons; diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index c963de9b..24a6fed4 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -28,6 +28,8 @@ struct sway_seat_device { struct sway_input_device *input_device; struct sway_keyboard *keyboard; struct sway_switch *switch_device; + struct sway_tablet *tablet; + struct sway_tablet_pad *tablet_pad; struct wl_list link; // sway_seat::devices }; diff --git a/include/sway/input/tablet.h b/include/sway/input/tablet.h new file mode 100644 index 00000000..f30e232a --- /dev/null +++ b/include/sway/input/tablet.h @@ -0,0 +1,62 @@ +#ifndef _SWAY_INPUT_TABLET_H +#define _SWAY_INPUT_TABLET_H +#include <wlr/types/wlr_layer_shell_v1.h> + +struct sway_seat; +struct wlr_tablet_tool; + +struct sway_tablet { + struct wl_list link; + struct sway_seat_device *seat_device; + struct wlr_tablet_v2_tablet *tablet_v2; +}; + +struct sway_tablet_tool { + struct sway_seat *seat; + struct sway_tablet *tablet; + struct wlr_tablet_v2_tablet_tool *tablet_v2_tool; + + double tilt_x, tilt_y; + + struct wl_listener set_cursor; + struct wl_listener tool_destroy; +}; + +struct sway_tablet_pad { + struct wl_list link; + struct sway_seat_device *seat_device; + struct sway_tablet *tablet; + struct wlr_tablet_v2_tablet_pad *tablet_v2_pad; + + struct wl_listener attach; + struct wl_listener button; + struct wl_listener ring; + struct wl_listener strip; + + struct wlr_surface *current_surface; + struct wl_listener surface_destroy; + + struct wl_listener tablet_destroy; +}; + +struct sway_tablet *sway_tablet_create(struct sway_seat *seat, + struct sway_seat_device *device); + +void sway_configure_tablet(struct sway_tablet *tablet); + +void sway_tablet_destroy(struct sway_tablet *tablet); + +void sway_tablet_tool_configure(struct sway_tablet *tablet, + struct wlr_tablet_tool *wlr_tool); + +struct sway_tablet_pad *sway_tablet_pad_create(struct sway_seat *seat, + struct sway_seat_device *device); + +void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad); + +void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad); + +void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad, + struct wlr_surface *surface); + +#endif |