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; return NULL;
} }
/** Get screens informations and fill global configuration. static bool
*/ screen_scan_randr(void)
void
screen_scan(void)
{ {
/* Check for extension before checking for XRandR */ /* Check for extension before checking for XRandR */
if(xcb_get_extension_data(globalconf.connection, &xcb_randr_id)->present) if(xcb_get_extension_data(globalconf.connection, &xcb_randr_id)->present)
@ -146,9 +144,16 @@ screen_scan(void)
globalconf.xinerama_is_active = true; globalconf.xinerama_is_active = true;
globalconf.screens.tab[0].visual = screen_default_visual(xutil_screen_get(globalconf.connection, globalconf.default_screen)); 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 */ /* Check for extension before checking for Xinerama */
if(xcb_get_extension_data(globalconf.connection, &xcb_xinerama_id)->present) 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); xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
globalconf.screens.tab[0].visual = screen_default_visual(s); 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 */ /* One screen only / Zaphod mode */
for(int screen = 0; for(int screen = 0;
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
@ -221,6 +233,14 @@ screen_scan(void)
} }
} }
/** 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; globalconf.screen_focus = globalconf.screens.tab;
} }