about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-11-27 17:04:35 +0000
committerokan <okan>2013-11-27 17:04:35 +0000
commit1b6ef8e9edfca41c4339c83b481d47d839100984 (patch)
treea2ce76598622cc687fc787efee7bc1aaab849e90
parentabf52049b9e93e026c9299f65f326b975fd2f2cc (diff)
downloadcwm-1b6ef8e9edfca41c4339c83b481d47d839100984.tar.gz
cwm-1b6ef8e9edfca41c4339c83b481d47d839100984.tar.xz
cwm-1b6ef8e9edfca41c4339c83b481d47d839100984.zip
alter -r1.145 getsizehints to deal with clients that don't have
WM_NORMAL_HINTS.
-rw-r--r--client.c64
1 files changed, 29 insertions, 35 deletions
diff --git a/client.c b/client.c
index 4a5d0c8..9834757 100644
--- a/client.c
+++ b/client.c
@@ -718,52 +718,46 @@ void
 client_getsizehints(struct client_ctx *cc)
 {
 	long		 tmp;
-	XSizeHints	*size;
+	XSizeHints	 size;
 
-	if ((size = XAllocSizeHints()) == NULL)
-		warnx("XAllocSizeHints failure");
+	if (!XGetWMNormalHints(X_Dpy, cc->win, &size, &tmp))
+		size.flags = 0;
 
-	if (!XGetWMNormalHints(X_Dpy, cc->win, size, &tmp))
-		size->flags = 0;
+	cc->hint.flags = size.flags;
 
-	cc->hint.flags = size->flags;
-
-	if (size->flags & PBaseSize) {
-		cc->hint.basew = size->base_width;
-		cc->hint.baseh = size->base_height;
-	} else if (size->flags & PMinSize) {
-		cc->hint.basew = size->min_width;
-		cc->hint.baseh = size->min_height;
+	if (size.flags & PBaseSize) {
+		cc->hint.basew = size.base_width;
+		cc->hint.baseh = size.base_height;
+	} else if (size.flags & PMinSize) {
+		cc->hint.basew = size.min_width;
+		cc->hint.baseh = size.min_height;
 	}
-	if (size->flags & PMinSize) {
-		cc->hint.minw = size->min_width;
-		cc->hint.minh = size->min_height;
-	} else if (size->flags & PBaseSize) {
-		cc->hint.minw = size->base_width;
-		cc->hint.minh = size->base_height;
+	if (size.flags & PMinSize) {
+		cc->hint.minw = size.min_width;
+		cc->hint.minh = size.min_height;
+	} else if (size.flags & PBaseSize) {
+		cc->hint.minw = size.base_width;
+		cc->hint.minh = size.base_height;
 	}
-	if (size->flags & PMaxSize) {
-		cc->hint.maxw = size->max_width;
-		cc->hint.maxh = size->max_height;
+	if (size.flags & PMaxSize) {
+		cc->hint.maxw = size.max_width;
+		cc->hint.maxh = size.max_height;
 	}
-	if (size->flags & PResizeInc) {
-		cc->hint.incw = size->width_inc;
-		cc->hint.inch = size->height_inc;
+	if (size.flags & PResizeInc) {
+		cc->hint.incw = size.width_inc;
+		cc->hint.inch = size.height_inc;
 	}
 	cc->hint.incw = MAX(1, cc->hint.incw);
 	cc->hint.inch = MAX(1, cc->hint.inch);
 
-	if (size->flags & PAspect) {
-		if (size->min_aspect.x > 0)
-			cc->hint.mina = (float)size->min_aspect.y /
-			    size->min_aspect.x;
-		if (size->max_aspect.y > 0)
-			cc->hint.maxa = (float)size->max_aspect.x /
-			    size->max_aspect.y;
+	if (size.flags & PAspect) {
+		if (size.min_aspect.x > 0)
+			cc->hint.mina = (float)size.min_aspect.y /
+			    size.min_aspect.x;
+		if (size.max_aspect.y > 0)
+			cc->hint.maxa = (float)size.max_aspect.x /
+			    size.max_aspect.y;
 	}
-
-	if (size)
-		XFree(size);
 }
 
 void