summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-07-22 20:42:25 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-07-22 20:42:25 +0000
commitd64ba1e5f599abc10ed3a65f6b1c6eeb02e18566 (patch)
tree266abe3c95877522141f18ae50f71224f0acbbcd
parentb81f30ea5d81586920c59ae605718569260159e0 (diff)
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.
-rw-r--r--app/cwm/calmwm.c26
-rw-r--r--app/cwm/calmwm.h4
2 files changed, 19 insertions, 11 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index c66736443..3c932fa17 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.c,v 1.24 2008/07/22 19:54:57 oga Exp $
+ * $Id: calmwm.c,v 1.25 2008/07/22 20:42:24 oga Exp $
*/
#include "headers.h"
@@ -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);
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index a04730187..cd0637651 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.62 2008/07/22 20:26:12 oga Exp $
+ * $Id: calmwm.h,v 1.63 2008/07/22 20:42:24 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -309,7 +309,7 @@ int input_keycodetrans(KeyCode, u_int, enum ctltype *,
char *);
int x_errorhandler(Display *, XErrorEvent *);
-void x_setup(char *display_name);
+void x_setup(void);
char *x_screenname(int);
void x_setupscreen(struct screen_ctx *, u_int);
__dead void usage(void);