- if(sticky == TopRight || sticky == BotRight)
- c->x = right - c->w;
- if(sticky == BotLeft || sticky == BotRight)
- c->y = bottom - c->h;
-
- resizetitle(c);
- wc.x = c->x;
- wc.y = c->y;
- wc.width = c->w;
- wc.height = c->h;
- if(c->w == sw && c->h == sh)
- wc.border_width = 0;
- else
- wc.border_width = 1;
- XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ if(w <= 0 || h <= 0)
+ return;
+ /* offscreen appearance fixes */
+ if(x > sw)
+ x = sw - w - 2 * c->border;
+ if(y > sh)
+ y = sh - h - 2 * c->border;
+ if(x + w + 2 * c->border < sx)
+ x = sx;
+ if(y + h + 2 * c->border < sy)
+ y = sy;
+ if(c->x != x || c->y != y || c->w != w || c->h != h) {
+ c->x = wc.x = x;
+ c->y = wc.y = y;
+ c->w = wc.width = w;
+ c->h = wc.height = h;
+ wc.border_width = c->border;
+ XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
+ configure(c);
+ XSync(dpy, False);
+ }
+}
+
+void
+setprops(Client *c) {
+ unsigned int i;
+
+ for(i = 0; i < ntags && i < sizeof prop - 1; i++)
+ prop[i] = c->tags[i] ? '1' : '0';
+ if(i < sizeof prop - 1)
+ prop[i++] = c->isfloating ? '1' : '0';
+ prop[i] = '\0';
+ XChangeProperty(dpy, c->win, dwmprops, XA_STRING, 8,
+ PropModeReplace, (unsigned char *)prop, i);
+}
+
+void
+unban(Client *c) {
+ if(!c->isbanned)
+ return;
+ XMapWindow(dpy, c->win);
+ setclientstate(c, NormalState);
+ c->isbanned = False;
+}
+
+void
+unmanage(Client *c, long state) {
+ XWindowChanges wc;
+
+ wc.border_width = c->oldborder;
+ /* The server grab construct avoids race conditions. */
+ XGrabServer(dpy);
+ XSetErrorHandler(xerrordummy);
+ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
+ detach(c);
+ detachstack(c);
+ if(sel == c)
+ focus(NULL);
+ XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+ setclientstate(c, state);
+ free(c->tags);
+ free(c);