X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Frandr.c;h=54d61dddbeaa28bd496b65ec907616ebeb52605d;hb=ede954128afca118025db6a04d4d9d259473c70f;hp=d7e1accab360fd688de099f1e6a734de66b69826;hpb=6a2728ba796aa88f7cae034b759169f032408d56;p=i3%2Fi3 diff --git a/src/randr.c b/src/randr.c index d7e1acca..54d61ddd 100644 --- a/src/randr.c +++ b/src/randr.c @@ -424,9 +424,9 @@ void init_ws_for_output(Output *output, Con *content) { /* 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; @@ -501,8 +501,9 @@ void init_ws_for_output(Output *output, Con *content) { /* 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); @@ -516,7 +517,7 @@ void init_ws_for_output(Output *output, Con *content) { Con *ws = create_workspace_on_output(output, content); /* TODO: Set focus in main.c */ - con_activate(ws); + con_focus(ws); } /* @@ -856,8 +857,9 @@ void randr_query_outputs(void) { /* 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; @@ -944,7 +946,9 @@ void randr_query_outputs(void) { 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 */ @@ -989,7 +993,7 @@ void randr_disable_output(Output *output) { 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); @@ -1035,7 +1039,7 @@ void randr_disable_output(Output *output) { 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"); }