aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway
diff options
context:
space:
mode:
authorLibravatar John Chadwick <johnwchadwick@gmail.com>2019-09-17 21:46:29 -0700
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-09-25 23:10:33 -0400
commit7e420cb6e4a334dea7296060820de12a768b76da (patch)
tree143678e6ff0a4b4223e2dfe30086eb5e2d2ab174 /include/sway
parentAdd support for fullscreen view direct scan-out (diff)
downloadsway-7e420cb6e4a334dea7296060820de12a768b76da.tar.gz
sway-7e420cb6e4a334dea7296060820de12a768b76da.tar.zst
sway-7e420cb6e4a334dea7296060820de12a768b76da.zip
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')
-rw-r--r--include/sway/input/cursor.h3
-rw-r--r--include/sway/input/seat.h2
-rw-r--r--include/sway/input/tablet.h62
-rw-r--r--include/sway/server.h2
4 files changed, 69 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 {
21 struct sway_node *node; 21 struct sway_node *node;
22 } previous; 22 } previous;
23 struct wlr_xcursor_manager *xcursor_manager; 23 struct wlr_xcursor_manager *xcursor_manager;
24 struct wl_list tablets;
25 struct wl_list tablet_pads;
24 26
25 const char *image; 27 const char *image;
26 struct wl_client *image_client; 28 struct wl_client *image_client;
@@ -42,6 +44,7 @@ struct sway_cursor {
42 44
43 struct wl_listener tool_axis; 45 struct wl_listener tool_axis;
44 struct wl_listener tool_tip; 46 struct wl_listener tool_tip;
47 struct wl_listener tool_proximity;
45 struct wl_listener tool_button; 48 struct wl_listener tool_button;
46 uint32_t tool_buttons; 49 uint32_t tool_buttons;
47 50
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 {
28 struct sway_input_device *input_device; 28 struct sway_input_device *input_device;
29 struct sway_keyboard *keyboard; 29 struct sway_keyboard *keyboard;
30 struct sway_switch *switch_device; 30 struct sway_switch *switch_device;
31 struct sway_tablet *tablet;
32 struct sway_tablet_pad *tablet_pad;
31 struct wl_list link; // sway_seat::devices 33 struct wl_list link; // sway_seat::devices
32}; 34};
33 35
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 @@
1#ifndef _SWAY_INPUT_TABLET_H
2#define _SWAY_INPUT_TABLET_H
3#include <wlr/types/wlr_layer_shell_v1.h>
4
5struct sway_seat;
6struct wlr_tablet_tool;
7
8struct sway_tablet {
9 struct wl_list link;
10 struct sway_seat_device *seat_device;
11 struct wlr_tablet_v2_tablet *tablet_v2;
12};
13
14struct sway_tablet_tool {
15 struct sway_seat *seat;
16 struct sway_tablet *tablet;
17 struct wlr_tablet_v2_tablet_tool *tablet_v2_tool;
18
19 double tilt_x, tilt_y;
20
21 struct wl_listener set_cursor;
22 struct wl_listener tool_destroy;
23};
24
25struct sway_tablet_pad {
26 struct wl_list link;
27 struct sway_seat_device *seat_device;
28 struct sway_tablet *tablet;
29 struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
30
31 struct wl_listener attach;
32 struct wl_listener button;
33 struct wl_listener ring;
34 struct wl_listener strip;
35
36 struct wlr_surface *current_surface;
37 struct wl_listener surface_destroy;
38
39 struct wl_listener tablet_destroy;
40};
41
42struct sway_tablet *sway_tablet_create(struct sway_seat *seat,
43 struct sway_seat_device *device);
44
45void sway_configure_tablet(struct sway_tablet *tablet);
46
47void sway_tablet_destroy(struct sway_tablet *tablet);
48
49void sway_tablet_tool_configure(struct sway_tablet *tablet,
50 struct wlr_tablet_tool *wlr_tool);
51
52struct sway_tablet_pad *sway_tablet_pad_create(struct sway_seat *seat,
53 struct sway_seat_device *device);
54
55void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad);
56
57void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad);
58
59void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
60 struct wlr_surface *surface);
61
62#endif
diff --git a/include/sway/server.h b/include/sway/server.h
index a43cbf72..cd411d3b 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -44,6 +44,8 @@ struct sway_server {
44 struct wlr_xdg_shell *xdg_shell; 44 struct wlr_xdg_shell *xdg_shell;
45 struct wl_listener xdg_shell_surface; 45 struct wl_listener xdg_shell_surface;
46 46
47 struct wlr_tablet_manager_v2 *tablet_v2;
48
47#if HAVE_XWAYLAND 49#if HAVE_XWAYLAND
48 struct sway_xwayland xwayland; 50 struct sway_xwayland xwayland;
49 struct wl_listener xwayland_surface; 51 struct wl_listener xwayland_surface;