exit with a proper error message when there are no outputs available (Thanks flo)

fixes #842
This commit is contained in:
Michael Stapelberg 2012-10-14 20:56:13 +02:00
parent e964e7b6cd
commit 34a5bbb7e9
1 changed files with 5 additions and 3 deletions

View File

@ -69,7 +69,7 @@ Output *get_first_output(void) {
if (output->active) if (output->active)
return output; return output;
return NULL; die("No usable outputs available.\n");
} }
/* /*
@ -647,8 +647,7 @@ void randr_query_outputs(void) {
output->active = false; output->active = false;
DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name); DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name);
if ((first = get_first_output()) == NULL) first = get_first_output();
die("No usable outputs available\n");
/* TODO: refactor the following code into a nice function. maybe /* TODO: refactor the following code into a nice function. maybe
* use an on_destroy callback which is implement differently for * use an on_destroy callback which is implement differently for
@ -736,6 +735,9 @@ void randr_query_outputs(void) {
disable_randr(conn); disable_randr(conn);
} }
/* Verifies that there is at least one active output as a side-effect. */
get_first_output();
/* Just go through each active output and assign one workspace */ /* Just go through each active output and assign one workspace */
TAILQ_FOREACH(output, &outputs, outputs) { TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active) if (!output->active)