aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2020-06-04 15:58:17 -0400
committerSimon Ser <contact@emersion.fr>2020-06-07 10:46:14 +0200
commitce494a5811ddd01b09295ae1a91596f74ee1823c (patch)
tree95236006998789a0adc707e6869fa1096fc506d6 /sway
parent7dec1f839847bf594ef9d62222380cbcc7ff8429 (diff)
input/tablet: allow moving tiling tablet v2 surfaces by pen input
Closes #5293.
Diffstat (limited to 'sway')
-rw-r--r--sway/input/seatop_default.c7
-rw-r--r--sway/input/seatop_move_tiling.c25
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,
};