X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=client.c;h=c716625533a1d83f003ca42ef60c9469155538c6;hp=9f46a0ef8869e585a459d582c22fd12e8415cd6a;hb=2091200c957783deed032380d56c4199a23c6b81;hpb=47765f728614c348aa7dfc2eed6f754efc376922 diff --git a/client.c b/client.c index 9f46a0e..c716625 100644 --- a/client.c +++ b/client.c @@ -1,14 +1,10 @@ /* See LICENSE file for copyright and license details. */ #include "dwm.h" #include -#include -#include #include /* static */ -static char prop[128]; - static void attachstack(Client *c) { c->snext = stack; @@ -102,10 +98,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 @@ -151,7 +145,7 @@ focus(Client *c) { grabbuttons(c, True); } sel = c; - drawstatus(); + drawbar(); if(!selscreen) return; if(c) { @@ -181,21 +175,6 @@ killclient(const char *arg) { XKillClient(dpy, sel->win); } -Bool -getprops(Client *c) { - unsigned int i; - Bool result = False; - - if(gettextprop(c->win, dwmprops, prop, sizeof prop)) { - for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++) - if((c->tags[i] = prop[i] == '1')) - result = True; - if(i < sizeof prop - 1 && prop[i] != '\0') - c->isfloating = prop[i] == '1'; - } - return result; -} - void manage(Window w, XWindowAttributes *wa) { unsigned int i; @@ -242,15 +221,15 @@ 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); + setclientstate(c, NormalState); 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 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); + 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