summary refs log tree commit diff
path: root/menu.c
diff options
context:
space:
mode:
authorokan <okan>2008-07-11 14:21:28 +0000
committerokan <okan>2008-07-11 14:21:28 +0000
commitb23fad398789ed8d7412813e5b178a38a6667ee7 (patch)
tree4abba8dd92715e6dc2a272a487b00542b06d40db /menu.c
parent734f45ab4bdaf25835e90a56a1803de23ff49975 (diff)
downloadcwm-b23fad398789ed8d7412813e5b178a38a6667ee7.tar.gz
cwm-b23fad398789ed8d7412813e5b178a38a6667ee7.tar.xz
cwm-b23fad398789ed8d7412813e5b178a38a6667ee7.zip
spacing, declaration lineup to be consistent throughout cwm,
readability, and a bit of knf.

ok oga@
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/menu.c b/menu.c
index 6db9a53..5b60b67 100644
--- a/menu.c
+++ b/menu.c
@@ -67,7 +67,7 @@ menu_filter(struct menu_q *menuq, char *prompt, char *initial, int dummy,
     void (*match)(struct menu_q *, struct menu_q *, char *),
     void (*print)(struct menu *, int))
 {
-	struct screen_ctx	*sc = screen_current();
+	struct screen_ctx	*sc;
 	struct menu_ctx		 mc;
 	struct menu_q		 resultq;
 	struct menu		*mi = NULL;
@@ -75,6 +75,8 @@ menu_filter(struct menu_q *menuq, char *prompt, char *initial, int dummy,
 	Window			 focuswin;
 	int			 Mask, focusrevert;
 
+	sc = screen_current();
+
 	TAILQ_INIT(&resultq);
 
 	bzero(&mc, sizeof(mc));
@@ -255,10 +257,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
     struct menu_q *resultq)
 {
 	struct menu	*mi;
-	int		 n = 0;
-	int		 dy;
-	int		 xsave, ysave;
-	int		 warp;
+	int		 n, dy, xsave, ysave;
 
 	if (mc->list) {
 		if (TAILQ_EMPTY(resultq) && mc->list) {
@@ -388,10 +387,12 @@ menu_handle_release(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc,
 static int
 menu_calc_entry(struct screen_ctx *sc, struct menu_ctx *mc, int x, int y)
 {
-	int entry = y / font_height();
+	int	 entry;
+
+	entry = y / font_height();
 
 	/* in bounds? */
-	if (x < 0 || x > mc->width || y < 0 || y > font_height()*mc->num ||
+	if (x < 0 || x > mc->width || y < 0 || y > font_height() * mc->num ||
 	    entry < 0 || entry >= mc->num)
 		entry = -1;