tadded some new convenience functions - dwm - [fork] customized build of dwm, t… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 30af19d4426ca32dc38318bbe87534cc44484998 | |
parent 5d9146ff372ae0c5196e290fb2c1f828d4137e20 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Mon, 19 Feb 2007 13:42:39 +0100 | |
added some new convenience functions | |
Diffstat: | |
M client.c | 49 ++++++++++++++++++++++-------… | |
M dwm.h | 5 ++++- | |
M tile.c | 5 +---- | |
M view.c | 11 ----------- | |
4 files changed, 40 insertions(+), 30 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -10,13 +10,6 @@ | |
/* static */ | |
static void | |
-detachstack(Client *c) { | |
- Client **tc; | |
- for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | |
- *tc = c->snext; | |
-} | |
- | |
-static void | |
grabbuttons(Client *c, Bool focused) { | |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | |
t@@ -68,6 +61,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) { | |
/* 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) { | |
XConfigureEvent ce; | |
t@@ -86,6 +93,24 @@ 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; | |
t@@ -95,8 +120,7 @@ focus(Client *c) { | |
} | |
if(c) { | |
detachstack(c); | |
- c->snext = stack; | |
- stack = c; | |
+ attachstack(c); | |
grabbuttons(c, True); | |
} | |
sel = c; | |
t@@ -189,11 +213,8 @@ manage(Window w, XWindowAttributes *wa) { | |
settags(c, t); | |
if(!c->isfloat) | |
c->isfloat = (t != 0) || c->isfixed; | |
- if(clients) | |
- clients->prev = c; | |
- c->next = clients; | |
- c->snext = stack; | |
- stack = clients = c; | |
+ attach(c); | |
+ attachstack(c); | |
c->isbanned = True; | |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | |
XMapWindow(dpy, c->win); | |
diff --git a/dwm.h b/dwm.h | |
t@@ -99,7 +99,11 @@ extern Display *dpy; | |
extern Window root, barwin; | |
/* client.c */ | |
+extern void attach(Client *c); /* attaches c to global … | |
+extern void attachstack(Client *c); /* attaches client to stack… | |
extern void configure(Client *c); /* send synthetic configure e… | |
+extern void detach(Client *c); /* detaches c from globa… | |
+extern void detachstack(Client *c); /* detaches client from sta… | |
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 su… | |
t@@ -144,7 +148,6 @@ extern void eprint(const char *errstr, ...); /* pri… | |
extern void spawn(Arg *arg); /* forks a new subprocess … | |
/* view.c */ | |
-extern void detach(Client *c); /* detaches c from globa… | |
extern void dofloat(void); /* arranges all windows floa… | |
extern void focusnext(Arg *arg); /* focuses next visible client… | |
extern void focusprev(Arg *arg); /* focuses previous visible cl… | |
diff --git a/tile.c b/tile.c | |
t@@ -125,10 +125,7 @@ zoom(Arg *arg) { | |
if(!(c = nextmanaged(c->next))) | |
return; | |
detach(c); | |
- if(clients) | |
- clients->prev = c; | |
- c->next = clients; | |
- clients = c; | |
+ attach(c); | |
focus(c); | |
arrange(); | |
} | |
diff --git a/view.c b/view.c | |
t@@ -8,17 +8,6 @@ | |
void (*arrange)(void) = DEFMODE; | |
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 | |
dofloat(void) { | |
Client *c; | |