about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-04-14 16:13:17 +0000
committerokan <okan>2013-04-14 16:13:17 +0000
commit6f185bb03c3ba0928ba6254485c710103379bd1a (patch)
treea1ad2c61058ca193942a4a00757ff25bd7c9a784
parenta957ed7c7dcc287afcf33547326717701a0445de (diff)
parent16ed8bf8e4f561049b732b326f3d0ee475fe13f6 (diff)
downloadcwm-6f185bb03c3ba0928ba6254485c710103379bd1a.tar.gz
cwm-6f185bb03c3ba0928ba6254485c710103379bd1a.tar.xz
cwm-6f185bb03c3ba0928ba6254485c710103379bd1a.zip
cvsimport
-rw-r--r--calmwm.c10
-rw-r--r--calmwm.h4
-rw-r--r--client.c4
-rw-r--r--group.c13
-rw-r--r--kbfunc.c1
-rw-r--r--menu.c2
-rw-r--r--mousefunc.c11
-rw-r--r--screen.c7
-rw-r--r--xutil.c10
9 files changed, 31 insertions, 31 deletions
diff --git a/calmwm.c b/calmwm.c
index 58cb768..237071b 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -129,8 +129,6 @@ dpy_init(const char *dpyname)
 {
 	int	i;
 
-	XSetErrorHandler(x_errorhandler);
-
 	if ((X_Dpy = XOpenDisplay(dpyname)) == NULL)
 		errx(1, "unable to open display \"%s\"",
 		    XDisplayName(dpyname));
@@ -146,7 +144,6 @@ dpy_init(const char *dpyname)
 static void
 x_setup(void)
 {
-	struct screen_ctx	*sc;
 	struct keybinding	*kb;
 	int			 i;
 
@@ -156,11 +153,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 f85d37a..6b6ce63 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -387,7 +387,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 *);
 
@@ -478,7 +478,7 @@ void			 xu_configure(struct client_ctx *);
 void			 xu_getatoms(void);
 unsigned long		 xu_getcolor(struct screen_ctx *, char *);
 int			 xu_getprop(Window, Atom, Atom, long, u_char **);
-int			 xu_getstate(struct client_ctx *, int *);
+int			 xu_getstate(Window, int *);
 int			 xu_getstrprop(Window, Atom, char **);
 void			 xu_key_grab(Window, int, int);
 void			 xu_key_ungrab(Window, int, int);
diff --git a/client.c b/client.c
index b3bce5d..380cd33 100644
--- a/client.c
+++ b/client.c
@@ -111,7 +111,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	}
 	client_draw_border(cc);
 
-	if (xu_getstate(cc, &state) < 0)
+	if (xu_getstate(cc->win, &state) < 0)
 		state = NormalState;
 
 	XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
@@ -125,7 +125,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	xu_configure(cc);
 
 	(state == IconicState) ? client_hide(cc) : client_unhide(cc);
-	xu_setstate(cc, cc->state);
 
 	TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
 	TAILQ_INSERT_TAIL(&Clientq, cc, entry);
@@ -448,7 +447,6 @@ client_ptrsave(struct client_ctx *cc)
 void
 client_hide(struct client_ctx *cc)
 {
-	/* XXX - add wm_state stuff */
 	XUnmapWindow(X_Dpy, cc->win);
 
 	cc->active = 0;
diff --git a/group.c b/group.c
index 3b21c68..34d0465 100644
--- a/group.c
+++ b/group.c
@@ -351,6 +351,7 @@ group_menu(XButtonEvent *e)
 	int			 i;
 
 	sc = screen_fromroot(e->root);
+
 	TAILQ_INIT(&menuq);
 
 	for (i = 0; i < CALMWM_NGROUPS; i++) {
@@ -374,15 +375,11 @@ group_menu(XButtonEvent *e)
 		return;
 
 	mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
+	if (mi != NULL && mi->ctx != NULL) {
+		gc = (struct group_ctx *)mi->ctx;
+		(gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc);
+	}
 
-	if (mi == NULL || mi->ctx == NULL)
-		goto cleanup;
-
-	gc = (struct group_ctx *)mi->ctx;
-
-	(gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc);
-
-cleanup:
 	menuq_clear(&menuq);
 }
 
diff --git a/kbfunc.c b/kbfunc.c
index 473d1de..bec81a4 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -335,6 +335,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
 	}
 
 	TAILQ_INIT(&menuq);
+
 	lbuf = NULL;
 	while ((buf = fgetln(fp, &len))) {
 		if (buf[len - 1] == '\n')
diff --git a/menu.c b/menu.c
index 90652d6..b467ffb 100644
--- a/menu.c
+++ b/menu.c
@@ -74,6 +74,7 @@ static void 		 menu_draw_entry(struct screen_ctx *, struct menu_ctx *,
 			     struct menu_q *, int, int);
 static int		 menu_calc_entry(struct screen_ctx *, struct menu_ctx *,
 			     int, int);
+static struct menu 	*menu_complete_path(struct menu_ctx *);
 static int		 menu_keycode(XKeyEvent *, enum ctltype *,
 			     char *);
 
@@ -208,6 +209,7 @@ menu_complete_path(struct menu_ctx *mc)
 	mr = xcalloc(1, sizeof(*mr));
 
 	TAILQ_INIT(&menuq);
+
 	if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL,
 	    CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) {
 		mr->abort = mi->abort;
diff --git a/mousefunc.c b/mousefunc.c
index d604a34..dcf1073 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -227,6 +227,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
 	old_cc = client_current();
 
 	TAILQ_INIT(&menuq);
+
 	TAILQ_FOREACH(cc, &Clientq, entry)
 		if (cc->flags & CLIENT_HIDDEN) {
 			wname = (cc->label) ? cc->label : cc->name;
@@ -250,8 +251,9 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
 		if (old_cc != NULL)
 			client_ptrsave(old_cc);
 		client_ptrwarp(cc);
-	} else
-		menuq_clear(&menuq);
+	}
+
+	menuq_clear(&menuq);
 }
 
 void
@@ -263,6 +265,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
 	struct cmd		*cmd;
 
 	TAILQ_INIT(&menuq);
+
 	TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
 		mi = xcalloc(1, sizeof(*mi));
 		(void)strlcpy(mi->text, cmd->label, sizeof(mi->text));
@@ -275,6 +278,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
 	mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
 	if (mi != NULL)
 		u_spawn(((struct cmd *)mi->ctx)->image);
-	else
-		menuq_clear(&menuq);
+
+	menuq_clear(&menuq);
 }
diff --git a/screen.c b/screen.c
index f63032e..64c4280 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);
 }
 
diff --git a/xutil.c b/xutil.c
index cb8b3fc..108421e 100644
--- a/xutil.c
+++ b/xutil.c
@@ -72,13 +72,13 @@ xu_btn_ungrab(Window win, int mask, u_int btn)
 }
 
 void
-xu_ptr_getpos(Window rootwin, int *x, int *y)
+xu_ptr_getpos(Window win, int *x, int *y)
 {
 	Window	 w0, w1;
 	int	 tmp0, tmp1;
 	u_int	 tmp2;
 
-	XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
+	XQueryPointer(X_Dpy, win, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
 }
 
 void
@@ -203,11 +203,11 @@ xu_getstrprop(Window win, Atom atm, char **text) {
 }
 
 int
-xu_getstate(struct client_ctx *cc, int *state)
+xu_getstate(Window win, int *state)
 {
 	long	*p = NULL;
 
-	if (xu_getprop(cc->win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L,
+	if (xu_getprop(win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L,
 	    (u_char **)&p) <= 0)
 		return (-1);
 
@@ -292,7 +292,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc)
 	XChangeProperty(X_Dpy, w, ewmh[_NET_SUPPORTING_WM_CHECK].atom,
 	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
 	XChangeProperty(X_Dpy, w, ewmh[_NET_WM_NAME].atom,
-	    XA_WM_NAME, 8, PropModeReplace, (unsigned char *)WMNAME,
+	    cwmh[UTF8_STRING].atom, 8, PropModeReplace, (unsigned char *)WMNAME,
 	    strlen(WMNAME));
 }