summaryrefslogtreecommitdiff
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2018-09-11 19:19:17 -0400
committerGitHub <[email protected]>2018-09-11 19:19:17 -0400
commit4fbec701fcf1505d1c13d7f5d8b55264b8f07e4e (patch)
tree82daa71d644f15c2e1e58ca9bdb2d4e1a75d3be9 /sway/tree/container.c
parent822b45f4836c9a22af5a283e2aea6e4ecd514c22 (diff)
parent679c7eb08c16daea8e3e1cff7bcf179e116d0e8e (diff)
Merge pull request #2618 from RyanDwyer/tiling-drag
Implement tiling drag
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 0a69f8d5..df064573 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -835,8 +835,14 @@ void container_end_mouse_operation(struct sway_container *container) {
struct sway_seat *seat;
wl_list_for_each(seat, &input_manager->seats, link) {
if (seat->op_container == container) {
+ seat->op_target_node = NULL; // ensure tiling move doesn't apply
seat_end_mouse_operation(seat);
}
+ // If the user is doing a tiling drag over this container,
+ // keep the operation active but unset the target container.
+ if (seat->op_target_node == &container->node) {
+ seat->op_target_node = NULL;
+ }
}
}
@@ -1057,7 +1063,8 @@ list_t *container_get_current_siblings(struct sway_container *container) {
}
void container_handle_fullscreen_reparent(struct sway_container *con) {
- if (!con->is_fullscreen || con->workspace->fullscreen == con) {
+ if (!con->is_fullscreen || !con->workspace ||
+ con->workspace->fullscreen == con) {
return;
}
if (con->workspace->fullscreen) {
@@ -1086,13 +1093,13 @@ void container_insert_child(struct sway_container *parent,
}
void container_add_sibling(struct sway_container *fixed,
- struct sway_container *active) {
+ struct sway_container *active, bool after) {
if (active->workspace) {
container_detach(active);
}
list_t *siblings = container_get_siblings(fixed);
int index = list_find(siblings, fixed);
- list_insert(siblings, index + 1, active);
+ list_insert(siblings, index + after, active);
active->parent = fixed->parent;
active->workspace = fixed->workspace;
container_for_each_child(active, set_workspace, NULL);
@@ -1145,7 +1152,7 @@ void container_detach(struct sway_container *child) {
void container_replace(struct sway_container *container,
struct sway_container *replacement) {
- container_add_sibling(container, replacement);
+ container_add_sibling(container, replacement, 1);
container_detach(container);
}