split x_setup() into two. dpy_init() for setting up the display and

checking the X config, and x_setup to set up the screens.

There's an ordering problem that means that some of this init needs to
come after the config is parsed, the rest should ideally happen before
though. This is a rough split, it will be refined later. Again, needed
for an upcoming change.

ok okan.
This commit is contained in:
oga 2008-07-22 20:42:24 +00:00
parent 20052e0248
commit 436a9e5c54
2 changed files with 17 additions and 9 deletions

View File

@ -45,6 +45,7 @@ struct conf Conf;
static char gray_bits[] = {0x02, 0x01}; static char gray_bits[] = {0x02, 0x01};
static void _sigchld_cb(int); static void _sigchld_cb(int);
static void dpy_init(const char *);
int int
main(int argc, char **argv) main(int argc, char **argv)
@ -78,10 +79,11 @@ main(int argc, char **argv)
group_init(); group_init();
Starting = 1; Starting = 1;
dpy_init(display_name);
bzero(&Conf, sizeof(Conf)); bzero(&Conf, sizeof(Conf));
conf_setup(&Conf, conf_file); conf_setup(&Conf, conf_file);
client_setup(); client_setup();
x_setup(display_name); x_setup();
Starting = 0; Starting = 0;
xev_init(); xev_init();
@ -106,21 +108,27 @@ main(int argc, char **argv)
} }
void void
x_setup(char *display_name) dpy_init(const char *dpyname)
{ {
struct screen_ctx *sc; int i;
int i;
TAILQ_INIT(&Screenq); if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
if ((X_Dpy = XOpenDisplay(display_name)) == NULL)
errx(1, "unable to open display \"%s\"", errx(1, "unable to open display \"%s\"",
XDisplayName(display_name)); XDisplayName(dpyname));
XSetErrorHandler(x_errorhandler); XSetErrorHandler(x_errorhandler);
Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i); Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i);
TAILQ_INIT(&Screenq);
}
void
x_setup(void)
{
struct screen_ctx *sc;
int i;
Nscreens = ScreenCount(X_Dpy); Nscreens = ScreenCount(X_Dpy);
for (i = 0; i < (int)Nscreens; i++) { for (i = 0; i < (int)Nscreens; i++) {
XMALLOC(sc, struct screen_ctx); XMALLOC(sc, struct screen_ctx);

View File

@ -309,7 +309,7 @@ int input_keycodetrans(KeyCode, u_int, enum ctltype *,
char *); char *);
int x_errorhandler(Display *, XErrorEvent *); int x_errorhandler(Display *, XErrorEvent *);
void x_setup(char *display_name); void x_setup(void);
char *x_screenname(int); char *x_screenname(int);
void x_setupscreen(struct screen_ctx *, u_int); void x_setupscreen(struct screen_ctx *, u_int);
__dead void usage(void); __dead void usage(void);