Fix changing of root workspace layout from stacked/tabbed

This commit is contained in:
Mihai Coman
2017-04-27 17:50:55 +03:00
parent 5376a972c4
commit 52ce8c803d
3 changed files with 243 additions and 6 deletions

View File

@ -1639,12 +1639,14 @@ void con_set_layout(Con *con, layout_t layout) {
* whole workspace into stacked/tabbed mode. To do this and still allow
* intuitive operations (like level-up and then opening a new window), we
* need to create a new split container. */
if (con->type == CT_WORKSPACE &&
(layout == L_STACKED || layout == L_TABBED)) {
if (con->type == CT_WORKSPACE) {
if (con_num_children(con) == 0) {
DLOG("Setting workspace_layout to %d\n", layout);
con->workspace_layout = layout;
} else {
layout_t ws_layout = (layout == L_STACKED || layout == L_TABBED) ? layout : L_DEFAULT;
DLOG("Setting workspace_layout to %d\n", ws_layout);
con->workspace_layout = ws_layout;
DLOG("Setting layout to %d\n", layout);
con->layout = layout;
} else if (layout == L_STACKED || layout == L_TABBED) {
DLOG("Creating new split container\n");
/* 1: create a new split container */
Con *new = con_new(NULL, NULL);