diff options
author | okan | 2013-11-27 17:04:35 +0000 |
---|---|---|
committer | okan | 2013-11-27 17:04:35 +0000 |
commit | 72c8c733abc4b5d19fd32263a7dcd08ab1e069fe (patch) | |
tree | b8e0fa96f70d4dedfa246ea7016ca191cd2be3ea /client.c | |
parent | eb44ceb50fa5b47b78cb98794a8c9f6b424aa000 (diff) | |
download | cwm-72c8c733abc4b5d19fd32263a7dcd08ab1e069fe.tar.gz |
alter -r1.145 getsizehints to deal with clients that don't have
WM_NORMAL_HINTS.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 66 |
1 files changed, 30 insertions, 36 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.151 2013/11/27 14:20:32 okan Exp $ + * $OpenBSD: client.c,v 1.152 2013/11/27 17:04:35 okan Exp $ */ #include <sys/param.h> @@ -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 |