Introduce output_primary_name function

Currently simply returns output->name, but this will make it easier to
change how output names are stored in the following commits.

Also replace reading output->name with invocations of
output_primary_name. Code which writes output->name is unchanged. Done
using a mostly mechanical replacement of output->name to
output_primary_name(output).
This commit is contained in:
Vladimir Panteleev
2017-09-09 07:18:29 +00:00
parent 0f2bce3916
commit 30b1ab38b3
12 changed files with 44 additions and 30 deletions

View File

@ -188,7 +188,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
struct Workspace_Assignment *assignment;
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->name, target_name) != 0 ||
strcmp(assignment->output, output->name) == 0)
strcmp(assignment->output, output_primary_name(output)) == 0)
continue;
assigned = true;
@ -935,7 +935,7 @@ bool workspace_move_to_output(Con *ws, const char *name) {
bool used_assignment = false;
struct Workspace_Assignment *assignment;
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (assignment->output == NULL || strcmp(assignment->output, current_output->name) != 0)
if (assignment->output == NULL || strcmp(assignment->output, output_primary_name(current_output)) != 0)
continue;
/* check if this workspace is already attached to the tree */