client.c
changeset 971 b2a0dfa22b1d
parent 970 d5c3537ee3be
child 974 408014d21261
--- a/client.c	Sun Aug 19 18:50:47 2007 +0200
+++ b/client.c	Wed Aug 22 19:01:05 2007 +0200
@@ -1,14 +1,11 @@
 /* See LICENSE file for copyright and license details. */
 #include "dwm.h"
 #include <stdlib.h>
-#include <string.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
 
 /* static */
 
-static char buf[128];
-
 static void
 attachstack(Client *c) {
 	c->snext = stack;
@@ -102,10 +99,8 @@
 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 @@
 		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 @@
 	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 @@
 }
 
 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 @@
 	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