Split up screen_scan()

This splits up screen_scan() into screen_scan_randr(), screen_scan_xinerama()
and screen_scan_x11(). These function try to set up screens via RANDR, Xinerama
and the classic core protcol setup.

No code in these functions was actually changed, only some indentation was
changed (and a "return true/false" added to the first two functions).

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-07-21 14:42:45 +02:00
parent 37703948b3
commit 7bf1370502
1 changed files with 88 additions and 68 deletions

View File

@ -72,10 +72,8 @@ screen_default_visual(xcb_screen_t *s)
return NULL;
}
/** Get screens informations and fill global configuration.
*/
void
screen_scan(void)
static bool
screen_scan_randr(void)
{
/* Check for extension before checking for XRandR */
if(xcb_get_extension_data(globalconf.connection, &xcb_randr_id)->present)
@ -146,10 +144,17 @@ screen_scan(void)
globalconf.xinerama_is_active = true;
globalconf.screens.tab[0].visual = screen_default_visual(xutil_screen_get(globalconf.connection, globalconf.default_screen));
return true;
}
}
else
{
return false;
}
static bool
screen_scan_xinerama(void)
{
/* Check for extension before checking for Xinerama */
if(xcb_get_extension_data(globalconf.connection, &xcb_xinerama_id)->present)
{
@ -202,8 +207,15 @@ screen_scan(void)
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
globalconf.screens.tab[0].visual = screen_default_visual(s);
return true;
}
else
return false;
}
static void screen_scan_x11(void)
{
/* One screen only / Zaphod mode */
for(int screen = 0;
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
@ -219,7 +231,15 @@ screen_scan(void)
s.visual = screen_default_visual(xcb_screen);
screen_array_append(&globalconf.screens, s);
}
}
}
/** Get screens informations and fill global configuration.
*/
void
screen_scan(void)
{
if(!screen_scan_randr() && !screen_scan_xinerama())
screen_scan_x11();
globalconf.screen_focus = globalconf.screens.tab;
}