get_first_output: prefer primary output
Used in two cases: - When the pointer location can't be found but some initial container needs to be focused - When moving disabled outputs
This commit is contained in:
parent
0845d7b264
commit
fd7e51927d
19
src/randr.c
19
src/randr.c
|
@ -70,11 +70,22 @@ Output *get_output_by_name(const char *name, const bool require_active) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Output *get_first_output(void) {
|
Output *get_first_output(void) {
|
||||||
Output *output;
|
Output *output, *result = NULL;
|
||||||
|
|
||||||
TAILQ_FOREACH(output, &outputs, outputs)
|
TAILQ_FOREACH(output, &outputs, outputs) {
|
||||||
if (output->active)
|
if (output->active) {
|
||||||
return output;
|
if (output->primary) {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
if (!result) {
|
||||||
|
result = output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
die("No usable outputs available.\n");
|
die("No usable outputs available.\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue