about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-04-12 14:46:30 +0000
committerokan <okan>2013-04-12 14:46:30 +0000
commit6296efadaa6bcc09068030bec4cb01904ca1a010 (patch)
tree45ea8b0efcb09a022ef8c6e1097334c6da1e48ad
parent90f95416c6f4461625dd37d5cc44dd92a067a030 (diff)
downloadcwm-6296efadaa6bcc09068030bec4cb01904ca1a010.tar.gz
cwm-6296efadaa6bcc09068030bec4cb01904ca1a010.tar.xz
cwm-6296efadaa6bcc09068030bec4cb01904ca1a010.zip
push Screenq into screen_init
-rw-r--r--calmwm.c8
-rw-r--r--calmwm.h2
-rw-r--r--screen.c7
3 files changed, 9 insertions, 8 deletions
diff --git a/calmwm.c b/calmwm.c
index 25ac559..d2aecf9 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -146,7 +146,6 @@ dpy_init(const char *dpyname)
 static void
 x_setup(void)
 {
-	struct screen_ctx	*sc;
 	struct keybinding	*kb;
 	int			 i;
 
@@ -156,11 +155,8 @@ x_setup(void)
 	Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
 	Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
 
-	for (i = 0; i < ScreenCount(X_Dpy); i++) {
-		sc = xcalloc(1, sizeof(*sc));
-		screen_init(sc, i);
-		TAILQ_INSERT_TAIL(&Screenq, sc, entry);
-	}
+	for (i = 0; i < ScreenCount(X_Dpy); i++)
+		screen_init(i);
 
 	/*
 	 * XXX key grabs weren't done before, since Screenq was empty,
diff --git a/calmwm.h b/calmwm.h
index c02db59..86650ca 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -375,7 +375,7 @@ void			 search_print_client(struct menu *, int);
 
 struct geom		 screen_find_xinerama(struct screen_ctx *, int, int);
 struct screen_ctx	*screen_fromroot(Window);
-void			 screen_init(struct screen_ctx *, u_int);
+void			 screen_init(u_int);
 void			 screen_update_geometry(struct screen_ctx *);
 void			 screen_updatestackingorder(struct screen_ctx *);
 
diff --git a/screen.c b/screen.c
index 6b7de6b..7eac18d 100644
--- a/screen.c
+++ b/screen.c
@@ -31,13 +31,16 @@
 #include "calmwm.h"
 
 void
-screen_init(struct screen_ctx *sc, u_int which)
+screen_init(u_int which)
 {
+	struct screen_ctx	*sc;
 	Window			*wins, w0, w1;
 	XWindowAttributes	 winattr;
 	XSetWindowAttributes	 rootattr;
 	u_int			 nwins, i;
 
+	sc = xcalloc(1, sizeof(*sc));
+
 	sc->which = which;
 	sc->visual = DefaultVisual(X_Dpy, sc->which);
 	sc->colormap = DefaultColormap(X_Dpy, sc->which);
@@ -84,6 +87,8 @@ screen_init(struct screen_ctx *sc, u_int which)
 	if (HasRandr)
 		XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask);
 
+	TAILQ_INSERT_TAIL(&Screenq, sc, entry);
+
 	XSync(X_Dpy, False);
 }