mirror of
https://github.com/swaywm/sway.git
synced 2026-04-25 06:46:24 -04:00
Stop destroying empty workspaces
Otherwise information about assigned output is lost
This commit is contained in:
parent
28cadf5580
commit
6c9995b859
9 changed files with 2 additions and 52 deletions
|
|
@ -56,8 +56,6 @@ void workspace_destroy(struct sway_workspace *workspace);
|
|||
|
||||
void workspace_begin_destroy(struct sway_workspace *workspace);
|
||||
|
||||
void workspace_consider_destroy(struct sway_workspace *ws);
|
||||
|
||||
char *workspace_next_name(const char *output_name);
|
||||
|
||||
bool workspace_switch(struct sway_workspace *workspace,
|
||||
|
|
|
|||
|
|
@ -601,15 +601,13 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
|||
// clean-up, destroying parents if the container was the last child
|
||||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
} else if (old_ws) {
|
||||
workspace_consider_destroy(old_ws);
|
||||
}
|
||||
|
||||
// arrange windows
|
||||
if (root->fullscreen_global) {
|
||||
arrange_root();
|
||||
} else {
|
||||
if (old_ws && !old_ws->node.destroying) {
|
||||
if (old_ws) {
|
||||
arrange_workspace(old_ws);
|
||||
}
|
||||
arrange_node(node_get_parent(destination));
|
||||
|
|
@ -643,8 +641,6 @@ static void workspace_move_to_output(struct sway_workspace *workspace,
|
|||
seat_set_raw_focus(seat, &ws->node);
|
||||
}
|
||||
|
||||
workspace_consider_destroy(new_output_old_ws);
|
||||
|
||||
output_sort_workspaces(output);
|
||||
struct sway_node *focus = seat_get_focus_inactive(seat, &workspace->node);
|
||||
seat_set_focus(seat, focus);
|
||||
|
|
@ -740,8 +736,6 @@ static struct cmd_results *cmd_move_in_direction(
|
|||
// clean-up, destroying parents if the container was the last child
|
||||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
} else if (old_ws) {
|
||||
workspace_consider_destroy(old_ws);
|
||||
}
|
||||
|
||||
struct sway_workspace *new_ws = container->workspace;
|
||||
|
|
|
|||
|
|
@ -36,12 +36,10 @@ struct cmd_results *cmd_sticky(int argc, char **argv) {
|
|||
"Expected output to have a workspace");
|
||||
}
|
||||
if (container->workspace != active_workspace) {
|
||||
struct sway_workspace *old_workspace = container->workspace;
|
||||
container_detach(container);
|
||||
workspace_add_floating(active_workspace, container);
|
||||
container_handle_fullscreen_reparent(container);
|
||||
arrange_workspace(active_workspace);
|
||||
workspace_consider_destroy(old_workspace);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1194,13 +1194,6 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
|
|||
}
|
||||
}
|
||||
|
||||
if (new_output_last_ws) {
|
||||
workspace_consider_destroy(new_output_last_ws);
|
||||
}
|
||||
if (last_workspace && last_workspace != new_output_last_ws) {
|
||||
workspace_consider_destroy(last_workspace);
|
||||
}
|
||||
|
||||
seat->has_focus = true;
|
||||
|
||||
if (config->smart_gaps && new_workspace) {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ void container_reap_empty(struct sway_container *con) {
|
|||
if (con->view) {
|
||||
return;
|
||||
}
|
||||
struct sway_workspace *ws = con->workspace;
|
||||
while (con) {
|
||||
if (con->children->length) {
|
||||
return;
|
||||
|
|
@ -130,9 +129,6 @@ void container_reap_empty(struct sway_container *con) {
|
|||
container_begin_destroy(con);
|
||||
con = parent;
|
||||
}
|
||||
if (ws) {
|
||||
workspace_consider_destroy(ws);
|
||||
}
|
||||
}
|
||||
|
||||
struct sway_container *container_flatten(struct sway_container *container) {
|
||||
|
|
|
|||
|
|
@ -216,12 +216,6 @@ static void output_evacuate(struct sway_output *output) {
|
|||
output_add_workspace(new_output, workspace);
|
||||
output_sort_workspaces(new_output);
|
||||
ipc_event_workspace(NULL, workspace, "move");
|
||||
|
||||
// If there is an old workspace (the noop output may not have one),
|
||||
// check to see if it is empty and should be destroyed.
|
||||
if (new_output_ws) {
|
||||
workspace_consider_destroy(new_output_ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ void root_scratchpad_show(struct sway_container *con) {
|
|||
// Show the container
|
||||
if (old_ws) {
|
||||
container_detach(con);
|
||||
workspace_consider_destroy(old_ws);
|
||||
} else {
|
||||
// Act on the ancestor of scratchpad hidden split containers
|
||||
while (con->parent) {
|
||||
|
|
|
|||
|
|
@ -843,14 +843,12 @@ void view_unmap(struct sway_view *view) {
|
|||
container_begin_destroy(view->container);
|
||||
if (parent) {
|
||||
container_reap_empty(parent);
|
||||
} else if (ws) {
|
||||
workspace_consider_destroy(ws);
|
||||
}
|
||||
|
||||
if (root->fullscreen_global) {
|
||||
// Container may have been a child of the root fullscreen container
|
||||
arrange_root();
|
||||
} else if (ws && !ws->node.destroying) {
|
||||
} else if (ws) {
|
||||
arrange_workspace(ws);
|
||||
workspace_detect_urgent(ws);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,26 +151,6 @@ void workspace_begin_destroy(struct sway_workspace *workspace) {
|
|||
node_set_dirty(&workspace->node);
|
||||
}
|
||||
|
||||
void workspace_consider_destroy(struct sway_workspace *ws) {
|
||||
if (ws->tiling->length || ws->floating->length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ws->output && output_get_active_workspace(ws->output) == ws) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct sway_seat *seat;
|
||||
wl_list_for_each(seat, &server.input->seats, link) {
|
||||
struct sway_node *node = seat_get_focus_inactive(seat, &root->node);
|
||||
if (node == &ws->node) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
workspace_begin_destroy(ws);
|
||||
}
|
||||
|
||||
static bool workspace_valid_on_output(const char *output_name,
|
||||
const char *ws_name) {
|
||||
struct workspace_config *wsc = workspace_find_config(ws_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue