X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=client.c;fp=client.c;h=9dd08b1ca6dae9d223a06fad6559a124db1ffb7b;hp=c03770b5cf4435d0f3e3c3f89162c8fbfd5d7ec9;hb=36672d0401299a5230b516ca4575365d9f45dd35;hpb=b18e6840152b300f2db8ff8dca16aee0839f864b diff --git a/client.c b/client.c index c03770b..9dd08b1 100644 --- a/client.c +++ b/client.c @@ -1,14 +1,11 @@ /* See LICENSE file for copyright and license details. */ #include "dwm.h" #include -#include #include #include /* static */ -static char buf[128]; - static void attachstack(Client *c) { c->snext = stack; @@ -102,10 +99,8 @@ void ban(Client *c) { if(c->isbanned) return; - XUnmapWindow(dpy, c->win); - setclientstate(c, IconicState); + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); c->isbanned = True; - c->unmapped++; } void @@ -181,21 +176,6 @@ killclient(const char *arg) { XKillClient(dpy, sel->win); } -Bool -getprops(Client *c) { - unsigned int i; - Bool result = False; - - if(gettextprop(c->win, dwmprops, buf, sizeof buf)) { - for(i = 0; i < ntags && i < sizeof buf - 1 && buf[i] != '\0'; i++) - if((c->tags[i] = buf[i] == '1')) - result = True; - if(i < sizeof buf - 1 && buf[i] != '\0') - c->isfloating = buf[i] == '1'; - } - return result; -} - void manage(Window w, XWindowAttributes *wa) { unsigned int i; @@ -242,15 +222,14 @@ manage(Window w, XWindowAttributes *wa) { if(t) for(i = 0; i < ntags; i++) c->tags[i] = t->tags[i]; - if(!getprops(c)) - applyrules(c); + applyrules(c); if(!c->isfloating) c->isfloating = (rettrans == Success) || c->isfixed; - setprops(c); attach(c); attachstack(c); XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */ ban(c); + XMapWindow(dpy, c->win); arrange(); } @@ -318,29 +297,15 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { } void -setprops(Client *c) { - unsigned int i; - - for(i = 0; i < ntags && i < sizeof buf - 1; i++) - buf[i] = c->tags[i] ? '1' : '0'; - if(i < sizeof buf - 1) - buf[i++] = c->isfloating ? '1' : '0'; - buf[i] = '\0'; - XChangeProperty(dpy, c->win, dwmprops, XA_STRING, 8, - PropModeReplace, (unsigned char *)buf, i); -} - -void unban(Client *c) { if(!c->isbanned) return; - XMapWindow(dpy, c->win); - setclientstate(c, NormalState); + XMoveWindow(dpy, c->win, c->x, c->y); c->isbanned = False; } void -unmanage(Client *c, long state) { +unmanage(Client *c) { XWindowChanges wc; wc.border_width = c->oldborder; @@ -353,14 +318,13 @@ unmanage(Client *c, long state) { if(sel == c) focus(NULL); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); - setclientstate(c, state); + setclientstate(c, WithdrawnState); free(c->tags); free(c); XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); - if(state != NormalState) - arrange(); + arrange(); } void