summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authoroga <oga>2008-07-22 20:42:24 +0000
committeroga <oga>2008-07-22 20:42:24 +0000
commit436a9e5c54297a7b9b684d307106e62764cd5e93 (patch)
tree3b6e6bccf9318a7c0795b502eb8b11f18a09e912 /calmwm.c
parent20052e024894b7cc2196c43076cfb441a57a99a6 (diff)
downloadcwm-436a9e5c54297a7b9b684d307106e62764cd5e93.tar.gz
cwm-436a9e5c54297a7b9b684d307106e62764cd5e93.tar.xz
cwm-436a9e5c54297a7b9b684d307106e62764cd5e93.zip
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.
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/calmwm.c b/calmwm.c
index 7fd7f90..419585d 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -45,6 +45,7 @@ struct conf			 Conf;
 static char gray_bits[] = {0x02, 0x01};
 
 static void	_sigchld_cb(int);
+static void	dpy_init(const char *);
 
 int
 main(int argc, char **argv)
@@ -78,10 +79,11 @@ main(int argc, char **argv)
 	group_init();
 
 	Starting = 1;
+	dpy_init(display_name);
 	bzero(&Conf, sizeof(Conf));
 	conf_setup(&Conf, conf_file);
 	client_setup();
-	x_setup(display_name);
+	x_setup();
 	Starting = 0;
 
 	xev_init();
@@ -106,21 +108,27 @@ main(int argc, char **argv)
 }
 
 void
-x_setup(char *display_name)
+dpy_init(const char *dpyname)
 {
-	struct screen_ctx	*sc;
-	int			 i;
-
-	TAILQ_INIT(&Screenq);
+	int	i;
 
-	if ((X_Dpy = XOpenDisplay(display_name)) == NULL)
+	if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
 		errx(1, "unable to open display \"%s\"",
-		    XDisplayName(display_name));
+		    XDisplayName(dpyname));
 
 	XSetErrorHandler(x_errorhandler);
 
 	Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i);
 
+	TAILQ_INIT(&Screenq);
+}
+
+void
+x_setup(void)
+{
+	struct screen_ctx	*sc;
+	int			 i;
+
 	Nscreens = ScreenCount(X_Dpy);
 	for (i = 0; i < (int)Nscreens; i++) {
 		XMALLOC(sc, struct screen_ctx);