From ce494a5811ddd01b09295ae1a91596f74ee1823c Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Thu, 4 Jun 2020 15:58:17 -0400 Subject: input/tablet: allow moving tiling tablet v2 surfaces by pen input Closes #5293. --- sway/input/seatop_default.c | 7 +++++++ 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, return; } + // Handle moving a tiling container + if (config->tiling_drag && mod_pressed && !is_floating_or_child && + cont->fullscreen_mode == FULLSCREEN_NONE) { + seatop_begin_move_tiling(seat, cont); + return; + } + seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); } 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, return layout_is_horiz == edge_is_horiz; } -static void handle_button(struct sway_seat *seat, uint32_t time_msec, - struct wlr_input_device *device, uint32_t button, - enum wlr_button_state state) { - if (seat->cursor->pressed_button_count != 0) { - return; - } - +static void finalize_move(struct sway_seat *seat) { struct seatop_move_tiling_event *e = seat->seatop_data; if (!e->target_node) { @@ -302,6 +296,22 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, seatop_begin_default(seat); } +static void handle_button(struct sway_seat *seat, uint32_t time_msec, + struct wlr_input_device *device, uint32_t button, + enum wlr_button_state state) { + if (seat->cursor->pressed_button_count == 0) { + finalize_move(seat); + } +} + +static void handle_tablet_tool_tip(struct sway_seat *seat, + struct sway_tablet_tool *tool, uint32_t time_msec, + enum wlr_tablet_tool_tip_state state) { + if (state == WLR_TABLET_TOOL_TIP_UP) { + finalize_move(seat); + } +} + static void handle_unref(struct sway_seat *seat, struct sway_container *con) { struct seatop_move_tiling_event *e = seat->seatop_data; if (e->target_node == &con->node) { // Drop target @@ -315,6 +325,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) { static const struct sway_seatop_impl seatop_impl = { .button = handle_button, .pointer_motion = handle_pointer_motion, + .tablet_tool_tip = handle_tablet_tool_tip, .unref = handle_unref, .render = handle_render, }; -- cgit v1.2.3