cleanup code of workspace rotation on output changes
This commit is contained in:
parent
2f992f5c0e
commit
eeb5bdd66f
27
src/randr.c
27
src/randr.c
|
@ -395,26 +395,27 @@ static void output_change_mode(xcb_connection_t *conn, Output *output) {
|
||||||
assert(output->con != NULL);
|
assert(output->con != NULL);
|
||||||
output->con->rect = output->rect;
|
output->con->rect = output->rect;
|
||||||
|
|
||||||
Con *current,*workspace,*child;
|
Con *content, *workspace, *child;
|
||||||
|
|
||||||
/* Point current to the container of the workspaces */
|
/* Point content to the container of the workspaces */
|
||||||
current = output->con->nodes_head.tqh_first->nodes.tqe_next;
|
content = output_get_content(output->con);
|
||||||
|
|
||||||
/* If default_orientation is NO_ORIENTATION, we change the orientation of
|
/* If default_orientation is NO_ORIENTATION, we change the orientation of
|
||||||
* the workspaces and their childs depending on output resolution. This is
|
* the workspaces and their childs depending on output resolution. This is
|
||||||
* only done for workspaces with maximum one child. */
|
* only done for workspaces with maximum one child. */
|
||||||
if (config.default_orientation == NO_ORIENTATION) {
|
if (config.default_orientation == NO_ORIENTATION) {
|
||||||
TAILQ_FOREACH(workspace, &(current->nodes_head), nodes) {
|
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
|
||||||
|
/* Workspaces with more than one child are left untouched because
|
||||||
|
* we do not want to change an existing layout. */
|
||||||
|
if (con_num_children(workspace) > 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Check if this workspace has <= 1 childs. */
|
workspace->orientation = (output->rect.height > output->rect.width) ? VERT : HORIZ;
|
||||||
child = workspace->nodes_head.tqh_first;
|
DLOG("Setting workspace [%d,%s]'s orientation to %d.\n", workspace->num, workspace->name, workspace->orientation);
|
||||||
if (child != NULL)
|
if ((child = TAILQ_FIRST(&(workspace->nodes_head)))) {
|
||||||
if (child->nodes.tqe_next == NULL) {
|
child->orientation = workspace->orientation;
|
||||||
workspace->orientation = (output->rect.height > output->rect.width) ? VERT : HORIZ;
|
DLOG("Setting child [%d,%s]'s orientation to %d.\n", child->num, child->name, child->orientation);
|
||||||
DLOG("Setting workspace [%d,%s]'s orientation to %d.\n", workspace->num, workspace->name, workspace->orientation);
|
}
|
||||||
child->orientation = workspace->orientation;
|
|
||||||
DLOG("Setting child [%d,%s]'s orientation to %d.\n", child->num, child->name, child->orientation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue