X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=client.c;h=a6b781517607b2a0827622aa0412423680385959;hp=c65a42b33a106ce60a77e5323efaa20b7a697953;hb=ac24f132dba7e59d9d9ff98d984f5e0b0d20fd09;hpb=5983c00b9508d48331b2c57f2c88ea09a8feb291 diff --git a/client.c b/client.c index c65a42b..a6b7815 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,4 @@ -/* (C)opyright MMVI Anselm R. Garbe +/* (C)opyright MMVI-MMVII Anselm R. Garbe * See LICENSE file for license details. */ #include "dwm.h" @@ -132,58 +132,6 @@ getctitle(Window w) { } void -gravitate(Client *c, Bool invert) { - int dx = 0, dy = 0; - - switch(c->grav) { - default: - break; - case StaticGravity: - case NorthWestGravity: - case NorthGravity: - case NorthEastGravity: - dy = c->border; - break; - case EastGravity: - case CenterGravity: - case WestGravity: - dy = -(c->h / 2) + c->border; - break; - case SouthEastGravity: - case SouthGravity: - case SouthWestGravity: - dy = -(c->h); - break; - } - switch (c->grav) { - default: - break; - case StaticGravity: - case NorthWestGravity: - case WestGravity: - case SouthWestGravity: - dx = c->border; - break; - case NorthGravity: - case CenterGravity: - case SouthGravity: - dx = -(c->w / 2) + c->border; - break; - case NorthEastGravity: - case EastGravity: - case SouthEastGravity: - dx = -(c->w + c->border); - break; - } - if(invert) { - dx = -dx; - dy = -dy; - } - c->x += dx; - c->y += dy; -} - -void killclient(Arg *arg) { if(!sel) return; @@ -202,13 +150,13 @@ manage(Window w, XWindowAttributes *wa) { c = emallocz(sizeof(Client)); c->tags = emallocz(ntags * sizeof(Bool)); c->win = w; + c->border = 0; c->x = c->tx = wa->x; c->y = c->ty = wa->y; c->w = c->tw = wa->width; c->h = wa->height; c->th = bh; - c->border = 0; - updatesize(c); + updatesizehints(c); if(c->x + c->w + 2 * BORDERPX > sw) c->x = sw - c->w - 2 * BORDERPX; if(c->x < sx) @@ -232,9 +180,7 @@ manage(Window w, XWindowAttributes *wa) { updatetitle(c); settags(c, getclient(trans)); if(!c->isfloat) - c->isfloat = trans - || (c->maxw && c->minw && - c->maxw == c->minw && c->maxh == c->minh); + c->isfloat = trans || c->isfixed; resizetitle(c); if(clients) clients->prev = c; @@ -310,7 +256,7 @@ resizetitle(Client *c) { } void -updatesize(Client *c) { +updatesizehints(Client *c) { long msize; XSizeHints size; @@ -341,10 +287,8 @@ updatesize(Client *c) { } else c->minw = c->minh = 0; - if(c->flags & PWinGravity) - c->grav = size.win_gravity; - else - c->grav = NorthWestGravity; + c->isfixed = (c->maxw && c->minw && c->maxh && c->minh && + c->maxw == c->minw && c->maxh == c->minh); } void @@ -361,12 +305,12 @@ updatetitle(Client *c) { if(!name.nitems) return; if(name.encoding == XA_STRING) - strncpy(c->name, (char *)name.value, sizeof(c->name)); + strncpy(c->name, (char *)name.value, sizeof c->name); else { if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { - strncpy(c->name, *list, sizeof(c->name)); + strncpy(c->name, *list, sizeof c->name); XFreeStringList(list); } }