about summary refs log tree commit diff stats
path: root/view.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-19 13:53:40 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-19 13:53:40 +0100
commitb3d7e07f18f0f69f8c3b3542615da62dfc4c6175 (patch)
tree55ef91ea3249738001b2f60aa80fb8d68af32862 /view.c
parent30af19d4426ca32dc38318bbe87534cc44484998 (diff)
downloaddwm-b3d7e07f18f0f69f8c3b3542615da62dfc4c6175.tar.gz
some more refactoring
Diffstat (limited to 'view.c')
-rw-r--r--view.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/view.c b/view.c
index cd07b94..4781b4e 100644
--- a/view.c
+++ b/view.c
@@ -8,6 +8,20 @@
 void (*arrange)(void) = DEFMODE;
 
 void
+attach(Client *c) {
+	if(clients)
+		clients->prev = c;
+	c->next = clients;
+	clients = c;
+}
+
+void
+attachstack(Client *c) {
+	c->snext = stack;
+	stack = c;
+}
+
+void
 dofloat(void) {
 	Client *c;
 
@@ -31,6 +45,24 @@ dofloat(void) {
 }
 
 void
+detach(Client *c) {
+	if(c->prev)
+		c->prev->next = c->next;
+	if(c->next)
+		c->next->prev = c->prev;
+	if(c == clients)
+		clients = c->next;
+	c->next = c->prev = NULL;
+}
+
+void
+detachstack(Client *c) {
+	Client **tc;
+	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
+	*tc = c->snext;
+}
+
+void
 focusnext(Arg *arg) {
 	Client *c;
    
@@ -62,6 +94,16 @@ focusprev(Arg *arg) {
 	}
 }
 
+Client *
+getclient(Window w) {
+	Client *c;
+
+	for(c = clients; c; c = c->next)
+		if(c->win == w)
+			return c;
+	return NULL;
+}
+
 Bool
 isvisible(Client *c) {
 	unsigned int i;