input/tablet: allow moving tiling tablet v2 surfaces by pen input

Closes #5293.
This commit is contained in:
Tudor Brindus 2020-06-04 15:58:17 -04:00 committed by Simon Ser
parent 7dec1f8398
commit ce494a5811
2 changed files with 25 additions and 7 deletions

View File

@ -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);
}

View File

@ -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,
};