diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-07-08 22:29:04 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-07-09 02:56:55 -0400 |
commit | 538b36c0e2f9f0bf64ef473789e2598ac7d1629f (patch) | |
tree | 1014b90ce73873ed0a4a1cf0e2d5c4612a1c691d /sway/input/seatop_move_tiling.c | |
parent | c9cb5ced7f7597afeb73fd5b661a98462f170d11 (diff) |
Make mouse drag in tiled mode swap containers if no edge is selected
Now the highlighted center area of containers triggers a swap action
instead of moving around the containers.
Diffstat (limited to 'sway/input/seatop_move_tiling.c')
-rw-r--r-- | sway/input/seatop_move_tiling.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index 7c31e695..e1506175 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -245,8 +245,12 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, target_node->sway_workspace : target_node->sway_container->workspace; enum wlr_edges edge = e->target_edge; int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT; + bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER; + + if (!swap) { + container_detach(con); + } - container_detach(con); // Moving container into empty workspace if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) { @@ -254,13 +258,17 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, } else if (target_node->type == N_CONTAINER) { // Moving container before/after another struct sway_container *target = target_node->sway_container; - enum sway_container_layout layout = container_parent_layout(target); - if (edge && !is_parallel(layout, edge)) { - enum sway_container_layout new_layout = edge == WLR_EDGE_TOP || - edge == WLR_EDGE_BOTTOM ? L_VERT : L_HORIZ; - container_split(target, new_layout); + if (swap) { + container_swap(target_node->sway_container, con); + } else { + enum sway_container_layout layout = container_parent_layout(target); + if (edge && !is_parallel(layout, edge)) { + enum sway_container_layout new_layout = edge == WLR_EDGE_TOP || + edge == WLR_EDGE_BOTTOM ? L_VERT : L_HORIZ; + container_split(target, new_layout); + } + container_add_sibling(target, con, after); } - container_add_sibling(target, con, after); } else { // Target is a workspace which requires splitting enum sway_container_layout new_layout = edge == WLR_EDGE_TOP || |