Skip to content

Commit

Permalink
input/tablet: allow moving tiling tablet v2 surfaces by pen input
Browse files Browse the repository at this point in the history
Closes swaywm#5293.
  • Loading branch information
Xyene committed Jun 4, 2020
1 parent 6128682 commit 2bbb36e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions sway/input/seatop_default.c
Expand Up @@ -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);
}

Expand Down
25 changes: 18 additions & 7 deletions sway/input/seatop_move_tiling.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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,
};
Expand Down

0 comments on commit 2bbb36e

Please sign in to comment.