about summary refs log tree commit diff
path: root/menu.c
diff options
context:
space:
mode:
authorokan <okan>2012-10-23 15:50:15 +0000
committerokan <okan>2012-10-23 15:50:15 +0000
commit637c52abf81512406d0f157357d961e72628f1da (patch)
tree57c9a7a561a4ffec7bdb88bdb5b5304446c3b588 /menu.c
parentc21d56e5a1c98eacb70f3197311232731ccf1a6f (diff)
downloadcwm-637c52abf81512406d0f157357d961e72628f1da.tar.gz
cwm-637c52abf81512406d0f157357d961e72628f1da.tar.xz
cwm-637c52abf81512406d0f157357d961e72628f1da.zip
treat menu width the same as the height is treated when deciding its
max size and location; partially from a diff from Alexander Polakov.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/menu.c b/menu.c
index 4090921..7a64cb2 100644
--- a/menu.c
+++ b/menu.c
@@ -358,10 +358,12 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
 	xsave = mc->x;
 	ysave = mc->y;
 
-	if (mc->x < xmin)
-		mc->x = xmin;
-	else if (mc->x + mc->width >= xmax)
+	if (mc->x + mc->width >= xmax)
 		mc->x = xmax - mc->width;
+	if (mc->x < xmin) {
+		mc->x = xmin;
+		mc->width = xmax - xmin;
+	}
 
 	if (mc->y + dy >= ymax)
 		mc->y = ymax - dy;