screen: Make sure we always have a screen

It is possible to configure RANDR so that no outputs are available. This means
awesome would be running with zero screens which leads to all kinds of
funnyness.

Work around this by falling back to other configuration mechanisms if we get no
screens from one of them. After all, screen_scan_x11() will always be able to
add a screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-09-27 23:07:33 +02:00
parent 1703801728
commit fd8f2e23ee
1 changed files with 8 additions and 2 deletions

View File

@ -75,6 +75,12 @@ screen_add(screen_t new_screen)
screen_array_append(&globalconf.screens, new_screen); screen_array_append(&globalconf.screens, new_screen);
} }
static bool
screens_exist(void)
{
return globalconf.screens.len > 0;
}
static bool static bool
screen_scan_randr(void) screen_scan_randr(void)
{ {
@ -150,7 +156,7 @@ screen_scan_randr(void)
p_delete(&screen_res_r); p_delete(&screen_res_r);
return true; return screens_exist();
} }
} }
@ -195,7 +201,7 @@ screen_scan_xinerama(void)
p_delete(&xsq); p_delete(&xsq);
return true; return screens_exist();
} }
return false; return false;