aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c15
-rw-r--r--sway/tree/view.c2
-rw-r--r--sway/tree/workspace.c15
3 files changed, 27 insertions, 5 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);
}
diff --git a/sway/tree/view.c b/sway/tree/view.c
index bdf4e32a..d02abf30 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -529,7 +529,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
view->container = container_create(view);
if (target_sibling) {
- container_add_sibling(target_sibling, view->container);
+ container_add_sibling(target_sibling, view->container, 1);
} else {
workspace_add_tiling(ws, view->container);
}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index b8e90892..18746430 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -557,6 +557,7 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws,
}
struct sway_container *workspace_wrap_children(struct sway_workspace *ws) {
+ struct sway_container *fs = ws->fullscreen;
struct sway_container *middle = container_create(NULL);
middle->layout = ws->layout;
while (ws->tiling->length) {
@@ -565,6 +566,7 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) {
container_add_child(middle, child);
}
workspace_add_tiling(ws, middle);
+ ws->fullscreen = fs;
return middle;
}
@@ -694,3 +696,16 @@ void workspace_get_box(struct sway_workspace *workspace, struct wlr_box *box) {
box->width = workspace->width;
box->height = workspace->height;
}
+
+static void count_tiling_views(struct sway_container *con, void *data) {
+ if (con->view && !container_is_floating_or_child(con)) {
+ size_t *count = data;
+ *count += 1;
+ }
+}
+
+size_t workspace_num_tiling_views(struct sway_workspace *ws) {
+ size_t count = 0;
+ workspace_for_each_container(ws, count_tiling_views, &count);
+ return count;
+}