aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_move_tiling.c
diff options
context:
space:
mode:
authorLibravatar Sebastian Parborg <darkdefende@gmail.com>2019-07-08 22:29:04 +0200
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-07-09 02:56:55 -0400
commit538b36c0e2f9f0bf64ef473789e2598ac7d1629f (patch)
tree1014b90ce73873ed0a4a1cf0e2d5c4612a1c691d /sway/input/seatop_move_tiling.c
parentcalibration_matrix: expect 6 individual values (diff)
downloadsway-538b36c0e2f9f0bf64ef473789e2598ac7d1629f.tar.gz
sway-538b36c0e2f9f0bf64ef473789e2598ac7d1629f.tar.zst
sway-538b36c0e2f9f0bf64ef473789e2598ac7d1629f.zip
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.c22
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,
245 target_node->sway_workspace : target_node->sway_container->workspace; 245 target_node->sway_workspace : target_node->sway_container->workspace;
246 enum wlr_edges edge = e->target_edge; 246 enum wlr_edges edge = e->target_edge;
247 int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT; 247 int after = edge != WLR_EDGE_TOP && edge != WLR_EDGE_LEFT;
248 bool swap = edge == WLR_EDGE_NONE && target_node->type == N_CONTAINER;
249
250 if (!swap) {
251 container_detach(con);
252 }
248 253
249 container_detach(con);
250 254
251 // Moving container into empty workspace 255 // Moving container into empty workspace
252 if (target_node->type == N_WORKSPACE && edge == WLR_EDGE_NONE) { 256 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,
254 } else if (target_node->type == N_CONTAINER) { 258 } else if (target_node->type == N_CONTAINER) {
255 // Moving container before/after another 259 // Moving container before/after another
256 struct sway_container *target = target_node->sway_container; 260 struct sway_container *target = target_node->sway_container;
257 enum sway_container_layout layout = container_parent_layout(target); 261 if (swap) {
258 if (edge && !is_parallel(layout, edge)) { 262 container_swap(target_node->sway_container, con);
259 enum sway_container_layout new_layout = edge == WLR_EDGE_TOP || 263 } else {
260 edge == WLR_EDGE_BOTTOM ? L_VERT : L_HORIZ; 264 enum sway_container_layout layout = container_parent_layout(target);
261 container_split(target, new_layout); 265 if (edge && !is_parallel(layout, edge)) {
266 enum sway_container_layout new_layout = edge == WLR_EDGE_TOP ||
267 edge == WLR_EDGE_BOTTOM ? L_VERT : L_HORIZ;
268 container_split(target, new_layout);
269 }
270 container_add_sibling(target, con, after);
262 } 271 }
263 container_add_sibling(target, con, after);
264 } else { 272 } else {
265 // Target is a workspace which requires splitting 273 // Target is a workspace which requires splitting
266 enum sway_container_layout new_layout = edge == WLR_EDGE_TOP || 274 enum sway_container_layout new_layout = edge == WLR_EDGE_TOP ||