diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-06-04 15:58:17 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-06-07 10:46:14 +0200 |
commit | ce494a5811ddd01b09295ae1a91596f74ee1823c (patch) | |
tree | 95236006998789a0adc707e6869fa1096fc506d6 | |
parent | input/tablet: allow moving floating tablet v2 surfaces by pen input (diff) | |
download | sway-ce494a5811ddd01b09295ae1a91596f74ee1823c.tar.gz sway-ce494a5811ddd01b09295ae1a91596f74ee1823c.tar.zst sway-ce494a5811ddd01b09295ae1a91596f74ee1823c.zip |
input/tablet: allow moving tiling tablet v2 surfaces by pen input
Closes #5293.
-rw-r--r-- | sway/input/seatop_default.c | 7 | ||||
-rw-r--r-- | sway/input/seatop_move_tiling.c | 25 |
2 files changed, 25 insertions, 7 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 46595fdd..3ef816fd 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -235,6 +235,13 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | // Handle moving a tiling container | ||
239 | if (config->tiling_drag && mod_pressed && !is_floating_or_child && | ||
240 | cont->fullscreen_mode == FULLSCREEN_NONE) { | ||
241 | seatop_begin_move_tiling(seat, cont); | ||
242 | return; | ||
243 | } | ||
244 | |||
238 | seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); | 245 | seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); |
239 | } | 246 | } |
240 | 247 | ||
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index a1aa5245..09689183 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c | |||
@@ -223,13 +223,7 @@ static bool is_parallel(enum sway_container_layout layout, | |||
223 | return layout_is_horiz == edge_is_horiz; | 223 | return layout_is_horiz == edge_is_horiz; |
224 | } | 224 | } |
225 | 225 | ||
226 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | 226 | static void finalize_move(struct sway_seat *seat) { |
227 | struct wlr_input_device *device, uint32_t button, | ||
228 | enum wlr_button_state state) { | ||
229 | if (seat->cursor->pressed_button_count != 0) { | ||
230 | return; | ||
231 | } | ||
232 | |||
233 | struct seatop_move_tiling_event *e = seat->seatop_data; | 227 | struct seatop_move_tiling_event *e = seat->seatop_data; |
234 | 228 | ||
235 | if (!e->target_node) { | 229 | if (!e->target_node) { |
@@ -302,6 +296,22 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
302 | seatop_begin_default(seat); | 296 | seatop_begin_default(seat); |
303 | } | 297 | } |
304 | 298 | ||
299 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | ||
300 | struct wlr_input_device *device, uint32_t button, | ||
301 | enum wlr_button_state state) { | ||
302 | if (seat->cursor->pressed_button_count == 0) { | ||
303 | finalize_move(seat); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | static void handle_tablet_tool_tip(struct sway_seat *seat, | ||
308 | struct sway_tablet_tool *tool, uint32_t time_msec, | ||
309 | enum wlr_tablet_tool_tip_state state) { | ||
310 | if (state == WLR_TABLET_TOOL_TIP_UP) { | ||
311 | finalize_move(seat); | ||
312 | } | ||
313 | } | ||
314 | |||
305 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | 315 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { |
306 | struct seatop_move_tiling_event *e = seat->seatop_data; | 316 | struct seatop_move_tiling_event *e = seat->seatop_data; |
307 | if (e->target_node == &con->node) { // Drop target | 317 | if (e->target_node == &con->node) { // Drop target |
@@ -315,6 +325,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | |||
315 | static const struct sway_seatop_impl seatop_impl = { | 325 | static const struct sway_seatop_impl seatop_impl = { |
316 | .button = handle_button, | 326 | .button = handle_button, |
317 | .pointer_motion = handle_pointer_motion, | 327 | .pointer_motion = handle_pointer_motion, |
328 | .tablet_tool_tip = handle_tablet_tool_tip, | ||
318 | .unref = handle_unref, | 329 | .unref = handle_unref, |
319 | .render = handle_render, | 330 | .render = handle_render, |
320 | }; | 331 | }; |