/* go through all assignments and move the existing workspaces to this output */
struct Workspace_Assignment *assignment;
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
- if (strcmp(assignment->output, output_primary_name(output)) != 0)
+ if (!output_triggers_assignment(output, assignment)) {
continue;
-
+ }
Con *workspace = get_existing_workspace_by_name(assignment->name);
if (workspace == NULL)
continue;
/* otherwise, we create the first assigned ws for this output */
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
- if (strcmp(assignment->output, output_primary_name(output)) != 0)
+ if (!output_triggers_assignment(output, assignment)) {
continue;
+ }
LOG("Initializing first assigned workspace \"%s\" for output \"%s\"\n",
assignment->name, assignment->output);
Con *ws = create_workspace_on_output(output, content);
/* TODO: Set focus in main.c */
- con_activate(ws);
+ con_focus(ws);
}
/*
}
/* 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 children depending on output resolution. This is
* only done for workspaces with maximum one child. */
if (config.default_orientation == NO_ORIENTATION) {
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
/* If there's no randr output, enable the output covering the root window. */
if (any_randr_output_active()) {
DLOG("Active RandR output found. Disabling root output.\n");
- if (root_output->active)
+ if (root_output && root_output->active) {
root_output->to_be_disabled = true;
+ }
} else {
DLOG("No active RandR output found. Enabling root output.\n");
root_output->active = true;
continue;
DLOG("Focusing primary output %s\n", output_primary_name(output));
- con_activate(con_descend_focused(output->con));
+ Con *content = output_get_content(output->con);
+ Con *ws = TAILQ_FIRST(&(content)->focus_head);
+ workspace_show(ws);
}
/* render_layout flushes */
if (current != next && TAILQ_EMPTY(&(current->focus_head))) {
/* the workspace is empty and not focused, get rid of it */
DLOG("Getting rid of current = %p / %s (empty, unfocused)\n", current, current->name);
- tree_close_internal(current, DONT_KILL_WINDOW, false, false);
+ tree_close_internal(current, DONT_KILL_WINDOW, false);
continue;
}
DLOG("Detaching current = %p / %s\n", current, current->name);
Con *con = output->con;
/* clear the pointer before calling tree_close_internal in which the memory is freed */
output->con = NULL;
- tree_close_internal(con, DONT_KILL_WINDOW, true, false);
+ tree_close_internal(con, DONT_KILL_WINDOW, true);
DLOG("Done. Should be fine now\n");
}