X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=client.c;h=f3c9bf20254a2e29307a7deda915d95602a8c53a;hb=7ece30ebc04640258b5e20dcc71f51e1b01c9222;hp=6a178f8c09fb13b54633c924ea8d077ca74503a7;hpb=1f18466409aeb40e27b79814247dbda2d40369e2;p=dwm.git diff --git a/client.c b/client.c index 6a178f8..f3c9bf2 100644 --- a/client.c +++ b/client.c @@ -7,7 +7,7 @@ #include #include -/* static functions */ +/* static */ static void detachstack(Client *c) { @@ -53,12 +53,19 @@ grabbuttons(Client *c, Bool focused) { GrabModeAsync, GrabModeSync, None, None); } +static void +setclientstate(Client *c, long state) { + long data[] = {state, None}; + XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, + PropModeReplace, (unsigned char *)data, 2); +} + static int xerrordummy(Display *dsply, XErrorEvent *ee) { return 0; } -/* extern functions */ +/* extern */ void configure(Client *c) { @@ -169,6 +176,7 @@ manage(Window w, XWindowAttributes *wa) { stack = clients = c; XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMapWindow(dpy, c->win); + setclientstate(c, NormalState); if(isvisible(c)) focus(c); arrange(); @@ -178,6 +186,8 @@ void resize(Client *c, Bool sizehints) { XWindowChanges wc; + if(c->w <= 0 || c->h <= 0) + return; if(sizehints) { if(c->incw) c->w -= (c->w - c->basew) % c->incw; @@ -291,6 +301,7 @@ unmanage(Client *c) { focus(nc); } XUngrabButton(dpy, AnyButton, AnyModifier, c->win); + setclientstate(c, WithdrawnState); free(c->tags); free(c); XSync(dpy, False);