mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
Merge branch 'master' of https://github.com/swaywm/sway
This commit is contained in:
commit
1758617f1e
4 changed files with 37 additions and 10 deletions
|
|
@ -135,4 +135,6 @@ void workspace_get_box(struct sway_workspace *workspace, struct wlr_box *box);
|
|||
|
||||
size_t workspace_num_tiling_views(struct sway_workspace *ws);
|
||||
|
||||
size_t workspace_num_sticky_containers(struct sway_workspace *ws);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1414,6 +1414,13 @@ struct sway_container *container_split(struct sway_container *child,
|
|||
struct sway_seat *seat = input_manager_get_default_seat();
|
||||
bool set_focus = (seat_get_focus(seat) == &child->node);
|
||||
|
||||
if (container_is_floating(child) && child->view) {
|
||||
view_set_tiled(child->view, true);
|
||||
if (child->view->using_csd) {
|
||||
child->border = child->saved_border;
|
||||
}
|
||||
}
|
||||
|
||||
struct sway_container *cont = container_create(NULL);
|
||||
cont->width = child->width;
|
||||
cont->height = child->height;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ static void evacuate_sticky(struct sway_workspace *old_ws,
|
|||
if (!sway_assert(new_ws, "New output does not have a workspace")) {
|
||||
return;
|
||||
}
|
||||
while (old_ws->floating->length) {
|
||||
while(old_ws->floating->length) {
|
||||
struct sway_container *sticky = old_ws->floating->items[0];
|
||||
container_detach(sticky);
|
||||
workspace_add_floating(new_ws, sticky);
|
||||
|
|
@ -195,18 +195,23 @@ static void output_evacuate(struct sway_output *output) {
|
|||
new_output = root->noop_output;
|
||||
}
|
||||
|
||||
if (workspace_is_empty(workspace)) {
|
||||
// If floating is not empty, there are sticky containers to move
|
||||
if (workspace->floating->length) {
|
||||
evacuate_sticky(workspace, new_output);
|
||||
}
|
||||
workspace_begin_destroy(workspace);
|
||||
continue;
|
||||
}
|
||||
|
||||
struct sway_workspace *new_output_ws =
|
||||
output_get_active_workspace(new_output);
|
||||
|
||||
if (workspace_is_empty(workspace)) {
|
||||
// If the new output has an active workspace (the noop output may
|
||||
// not have one), move all sticky containers to it
|
||||
if (new_output_ws &&
|
||||
workspace_num_sticky_containers(workspace) > 0) {
|
||||
evacuate_sticky(workspace, new_output);
|
||||
}
|
||||
|
||||
if (workspace_num_sticky_containers(workspace) == 0) {
|
||||
workspace_begin_destroy(workspace);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
workspace_output_add_priority(workspace, new_output);
|
||||
output_add_workspace(new_output, workspace);
|
||||
output_sort_workspaces(new_output);
|
||||
|
|
|
|||
|
|
@ -821,3 +821,16 @@ size_t workspace_num_tiling_views(struct sway_workspace *ws) {
|
|||
workspace_for_each_container(ws, count_tiling_views, &count);
|
||||
return count;
|
||||
}
|
||||
|
||||
static void count_sticky_containers(struct sway_container *con, void *data) {
|
||||
if (container_is_floating(con) && con->is_sticky) {
|
||||
size_t *count = data;
|
||||
*count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
size_t workspace_num_sticky_containers(struct sway_workspace *ws) {
|
||||
size_t count = 0;
|
||||
workspace_for_each_container(ws, count_sticky_containers, &count);
|
||||
return count;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue