clean some awesome.c stuff

This commit is contained in:
Julien Danjou 2007-12-31 10:10:24 +01:00
parent b9d6a93c59
commit 52920a849b
1 changed files with 14 additions and 11 deletions

View File

@ -200,6 +200,7 @@ static void
setup(int screen) setup(int screen)
{ {
XSetWindowAttributes wa; XSetWindowAttributes wa;
Statusbar *statusbar;
/* init cursors */ /* init cursors */
globalconf.cursor[CurNormal] = XCreateFontCursor(globalconf.display, XC_left_ptr); globalconf.cursor[CurNormal] = XCreateFontCursor(globalconf.display, XC_left_ptr);
@ -220,6 +221,9 @@ setup(int screen)
wa.event_mask); wa.event_mask);
grabkeys(get_phys_screen(screen)); grabkeys(get_phys_screen(screen));
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
statusbar_init(statusbar, screen);
} }
/** Startup Error handler to check if another window manager /** Startup Error handler to check if another window manager
@ -292,13 +296,13 @@ main(int argc, char *argv[])
int screen; int screen;
event_handler **handler; event_handler **handler;
struct sockaddr_un *addr; struct sockaddr_un *addr;
Statusbar *statusbar;
/* check args */
if(argc >= 2) if(argc >= 2)
{ {
if(!a_strcmp("-v", argv[1]) || !a_strcmp("--version", argv[1])) if(!a_strcmp("-v", argv[1]) || !a_strcmp("--version", argv[1]))
{ {
printf("awesome-" VERSION " (" RELEASE ")\n"); printf("awesome " VERSION " (" RELEASE ")\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if(!a_strcmp("-c", argv[1])) else if(!a_strcmp("-c", argv[1]))
@ -312,9 +316,7 @@ main(int argc, char *argv[])
eprint("options: [-v | -c configfile]\n"); eprint("options: [-v | -c configfile]\n");
} }
/* Tag won't be printed otherwised */ /* X stuff */
setlocale(LC_CTYPE, "");
if(!(dpy = XOpenDisplay(NULL))) if(!(dpy = XOpenDisplay(NULL)))
eprint("cannot open display\n"); eprint("cannot open display\n");
@ -330,22 +332,23 @@ main(int argc, char *argv[])
XSetErrorHandler(NULL); XSetErrorHandler(NULL);
xerrorxlib = XSetErrorHandler(xerror); xerrorxlib = XSetErrorHandler(xerror);
XSync(dpy, False); XSync(dpy, False);
/* store display */
globalconf.display = dpy; globalconf.display = dpy;
/* init EWMH atoms */
ewmh_init_atoms(); ewmh_init_atoms();
/* init screens struct */
globalconf.screens = p_new(VirtScreen, get_screen_count()); globalconf.screens = p_new(VirtScreen, get_screen_count());
focus_add_client(NULL); focus_add_client(NULL);
/* store display */
/* parse config */
config_parse(confpath); config_parse(confpath);
/* for each virtual screen */
for(screen = 0; screen < get_screen_count(); screen++) for(screen = 0; screen < get_screen_count(); screen++)
{
/* set screen */
setup(screen); setup(screen);
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
statusbar_init(statusbar, screen);
}
/* do this only for real screen */ /* do this only for real screen */
for(screen = 0; screen < ScreenCount(dpy); screen++) for(screen = 0; screen < ScreenCount(dpy); screen++)