[hackers] [dwm] some more refactoring

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Mon Feb 19 13:57:51 2007

changeset: 772:a1dd3d977e25
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Mon Feb 19 13:53:40 2007 +0100
summary: some more refactoring

diff -r 05946fa53085 -r a1dd3d977e25 client.c
--- a/client.c Mon Feb 19 13:42:39 2007 +0100
+++ b/client.c Mon Feb 19 13:53:40 2007 +0100
@@ -59,20 +59,6 @@ xerrordummy(Display *dsply, XErrorEvent
 }
 
 /* extern */
-
-void
-attach(Client *c) {
- if(clients)
- clients->prev = c;
- c->next = clients;
- clients = c;
-}
-
-void
-attachstack(Client *c) {
- c->snext = stack;
- stack = c;
-}
 
 void
 configure(Client *c) {
@@ -93,24 +79,6 @@ configure(Client *c) {
 }
 
 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
 focus(Client *c) {
         if(c && !isvisible(c))
                 return;
@@ -133,16 +101,6 @@ focus(Client *c) {
         }
         else
                 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
-}
-
-Client *
-getclient(Window w) {
- Client *c;
-
- for(c = clients; c; c = c->next)
- if(c->win == w)
- return c;
- return NULL;
 }
 
 Bool
diff -r 05946fa53085 -r a1dd3d977e25 dwm.h
--- a/dwm.h Mon Feb 19 13:42:39 2007 +0100
+++ b/dwm.h Mon Feb 19 13:53:40 2007 +0100
@@ -99,13 +99,8 @@ extern Window root, barwin;
 extern Window root, barwin;
 
 /* client.c */
-extern void attach(Client *c); /* attaches c to global client list */
-extern void attachstack(Client *c); /* attaches client to stack */
 extern void configure(Client *c); /* send synthetic configure event */
-extern void detach(Client *c); /* detaches c from global client list */
-extern void detachstack(Client *c); /* detaches client from stack */
 extern void focus(Client *c); /* focus c, c may be NULL */
-extern Client *getclient(Window w); /* return client of w */
 extern Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */
 extern void killclient(Arg *arg); /* kill c nicely */
 extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
@@ -148,9 +143,14 @@ extern void spawn(Arg *arg); /* forks
 extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */
 
 /* view.c */
+extern void attach(Client *c); /* attaches c to global client list */
+extern void attachstack(Client *c); /* attaches client to stack */
 extern void dofloat(void); /* arranges all windows floating */
+extern void detach(Client *c); /* detaches c from global client list */
+extern void detachstack(Client *c); /* detaches client from stack */
 extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
 extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
+extern Client *getclient(Window w); /* return client of w */
 extern Bool isvisible(Client *c); /* returns True if client is visible */
 extern Client *nextmanaged(Client *c); /* returns managed successor of c */
 extern void restack(void); /* restores z layers of all clients */
diff -r 05946fa53085 -r a1dd3d977e25 view.c
--- a/view.c Mon Feb 19 13:42:39 2007 +0100
+++ b/view.c Mon Feb 19 13:53:40 2007 +0100
@@ -6,6 +6,20 @@
 /* extern */
 
 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) {
@@ -28,6 +42,24 @@ dofloat(void) {
                 focus(c);
         }
         restack();
+}
+
+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
@@ -60,6 +92,16 @@ focusprev(Arg *arg) {
                 focus(c);
                 restack();
         }
+}
+
+Client *
+getclient(Window w) {
+ Client *c;
+
+ for(c = clients; c; c = c->next)
+ if(c->win == w)
+ return c;
+ return NULL;
 }
 
 Bool
Received on Mon Feb 19 2007 - 13:57:51 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:28 UTC