diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-06-19 14:11:57 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-10-12 15:01:37 +0200 |
commit | ed247c031cb9783deb5c04631b53c5ac6c432eb7 (patch) | |
tree | 3b8aa74d49d6e6cb1518cd749854cba13728f259 /include | |
parent | input/cursor: default tablet lens tool to relative motion (diff) | |
download | sway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.tar.gz sway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.tar.zst sway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.zip |
input/tablet: add tool_mode option to set tablet tools as relative input
Closes #4139.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/commands.h | 1 | ||||
-rw-r--r-- | include/sway/config.h | 9 | ||||
-rw-r--r-- | include/sway/input/tablet.h | 6 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index f549626b..964b3661 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -264,6 +264,7 @@ sway_cmd input_cmd_scroll_button; | |||
264 | sway_cmd input_cmd_scroll_method; | 264 | sway_cmd input_cmd_scroll_method; |
265 | sway_cmd input_cmd_tap; | 265 | sway_cmd input_cmd_tap; |
266 | sway_cmd input_cmd_tap_button_map; | 266 | sway_cmd input_cmd_tap_button_map; |
267 | sway_cmd input_cmd_tool_mode; | ||
267 | sway_cmd input_cmd_xkb_capslock; | 268 | sway_cmd input_cmd_xkb_capslock; |
268 | sway_cmd input_cmd_xkb_file; | 269 | sway_cmd input_cmd_xkb_file; |
269 | sway_cmd input_cmd_xkb_layout; | 270 | sway_cmd input_cmd_xkb_layout; |
diff --git a/include/sway/config.h b/include/sway/config.h index ee1852d4..473f723b 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -6,11 +6,13 @@ | |||
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/interfaces/wlr_switch.h> | 7 | #include <wlr/interfaces/wlr_switch.h> |
8 | #include <wlr/types/wlr_box.h> | 8 | #include <wlr/types/wlr_box.h> |
9 | #include <wlr/types/wlr_tablet_tool.h> | ||
9 | #include <xkbcommon/xkbcommon.h> | 10 | #include <xkbcommon/xkbcommon.h> |
10 | #include "../include/config.h" | 11 | #include "../include/config.h" |
11 | #include "list.h" | 12 | #include "list.h" |
12 | #include "swaynag.h" | 13 | #include "swaynag.h" |
13 | #include "tree/container.h" | 14 | #include "tree/container.h" |
15 | #include "sway/input/tablet.h" | ||
14 | #include "sway/tree/root.h" | 16 | #include "sway/tree/root.h" |
15 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 17 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
16 | 18 | ||
@@ -116,6 +118,11 @@ enum input_config_mapped_to { | |||
116 | MAPPED_TO_REGION, | 118 | MAPPED_TO_REGION, |
117 | }; | 119 | }; |
118 | 120 | ||
121 | struct input_config_tool { | ||
122 | enum wlr_tablet_tool_type type; | ||
123 | enum sway_tablet_tool_mode mode; | ||
124 | }; | ||
125 | |||
119 | /** | 126 | /** |
120 | * options for input devices | 127 | * options for input devices |
121 | */ | 128 | */ |
@@ -160,6 +167,8 @@ struct input_config { | |||
160 | char *mapped_to_output; | 167 | char *mapped_to_output; |
161 | struct wlr_box *mapped_to_region; | 168 | struct wlr_box *mapped_to_region; |
162 | 169 | ||
170 | list_t *tools; | ||
171 | |||
163 | bool capturable; | 172 | bool capturable; |
164 | struct wlr_box region; | 173 | struct wlr_box region; |
165 | }; | 174 | }; |
diff --git a/include/sway/input/tablet.h b/include/sway/input/tablet.h index f30e232a..d7e4c242 100644 --- a/include/sway/input/tablet.h +++ b/include/sway/input/tablet.h | |||
@@ -11,11 +11,17 @@ struct sway_tablet { | |||
11 | struct wlr_tablet_v2_tablet *tablet_v2; | 11 | struct wlr_tablet_v2_tablet *tablet_v2; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | enum sway_tablet_tool_mode { | ||
15 | SWAY_TABLET_TOOL_MODE_ABSOLUTE, | ||
16 | SWAY_TABLET_TOOL_MODE_RELATIVE, | ||
17 | }; | ||
18 | |||
14 | struct sway_tablet_tool { | 19 | struct sway_tablet_tool { |
15 | struct sway_seat *seat; | 20 | struct sway_seat *seat; |
16 | struct sway_tablet *tablet; | 21 | struct sway_tablet *tablet; |
17 | struct wlr_tablet_v2_tablet_tool *tablet_v2_tool; | 22 | struct wlr_tablet_v2_tablet_tool *tablet_v2_tool; |
18 | 23 | ||
24 | enum sway_tablet_tool_mode mode; | ||
19 | double tilt_x, tilt_y; | 25 | double tilt_x, tilt_y; |
20 | 26 | ||
21 | struct wl_listener set_cursor; | 27 | struct wl_listener set_cursor; |