tapplied dfenze cleanups, fixed some comments in dwm.h - dwm - [fork] customize… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ab3d6a7dfe76d9857f2fc621034359a2a0bf09df | |
parent c67dbb28e47b03eca0c7faddcf7c9862c41694b7 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Mon, 14 May 2007 11:54:30 +0200 | |
applied dfenze cleanups, fixed some comments in dwm.h | |
Diffstat: | |
M client.c | 14 ++++++++++---- | |
M dwm.h | 9 +++++---- | |
M event.c | 3 +-- | |
M layout.c | 15 ++++----------- | |
4 files changed, 20 insertions(+), 21 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -153,6 +153,14 @@ focus(Client *c) { | |
} | |
void | |
+focustopvisible(void) { | |
+ Client *c; | |
+ | |
+ for(c = stack; c && !isvisible(c); c = c->snext); | |
+ focus(c); | |
+} | |
+ | |
+void | |
killclient(const char *arg) { | |
XEvent ev; | |
t@@ -391,10 +399,8 @@ unmanage(Client *c) { | |
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ | |
detach(c); | |
detachstack(c); | |
- if(sel == c) { | |
- for(nc = stack; nc && !isvisible(nc); nc = nc->snext); | |
- focus(nc); | |
- } | |
+ if(sel == c) | |
+ focustopvisible(); | |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | |
setclientstate(c, WithdrawnState); | |
free(c->tags); | |
diff --git a/dwm.h b/dwm.h | |
t@@ -100,11 +100,12 @@ void attach(Client *c); /* attach… | |
void configure(Client *c); /* send synthetic configure event */ | |
void detach(Client *c); /* detaches c from global clien… | |
void focus(Client *c); /* focus c, c may be NULL */ | |
-void killclient(const char *arg); /* kill c nicely */ | |
+void focustopvisible(void); /* focus top visible window on stack */ | |
+void killclient(const char *arg); /* kill sel nicely */ | |
void manage(Window w, XWindowAttributes *wa); /* manage new client */ | |
void resize(Client *c, int x, int y, | |
int w, int h, Bool sizehints); /* resize with given coo… | |
-void togglefloating(const char *arg); /* toggles focused client between… | |
+void togglefloating(const char *arg); /* toggles sel between floating/t… | |
void updatesizehints(Client *c); /* update the size hint variab… | |
void updatetitle(Client *c); /* update the name of c */ | |
void unmanage(Client *c); /* destroy c */ | |
t@@ -137,8 +138,8 @@ int xerror(Display *dsply, XErrorEvent *ee); /* dwm… | |
void compileregs(void); /* initialize regexps of rules … | |
Bool isvisible(Client *c); /* returns True if client is visible… | |
void settags(Client *c, Client *trans); /* sets tags of c */ | |
-void tag(const char *arg); /* tags c with arg's index */ | |
-void toggletag(const char *arg); /* toggles c tags with arg's i… | |
+void tag(const char *arg); /* tags sel with arg's index */ | |
+void toggletag(const char *arg); /* toggles sel tags with arg's… | |
void toggleview(const char *arg); /* toggles the tag with arg's index (… | |
void view(const char *arg); /* views the tag with arg's index */ | |
diff --git a/event.c b/event.c | |
t@@ -247,8 +247,7 @@ enternotify(XEvent *e) { | |
focus(c); | |
else if(ev->window == root) { | |
selscreen = True; | |
- for(c = stack; c && !isvisible(c); c = c->snext); | |
- focus(c); | |
+ focustopvisible(); | |
} | |
} | |
diff --git a/layout.c b/layout.c | |
t@@ -61,10 +61,8 @@ tile(void) { | |
c->isbanned = True; | |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | |
} | |
- if(!sel || !isvisible(sel)) { | |
- for(c = stack; c && !isvisible(c); c = c->snext); | |
- focus(c); | |
- } | |
+ if(!sel || !isvisible(sel)) | |
+ focustopvisible(); | |
restack(); | |
} | |
t@@ -88,10 +86,8 @@ floating(void) { | |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | |
} | |
} | |
- if(!sel || !isvisible(sel)) { | |
- for(c = stack; c && !isvisible(c); c = c->snext); | |
- focus(c); | |
- } | |
+ if(!sel || !isvisible(sel)) | |
+ focustopvisible(); | |
restack(); | |
} | |
t@@ -241,13 +237,10 @@ togglemax(const char *arg) { | |
void | |
zoom(const char *arg) { | |
- unsigned int n; | |
Client *c; | |
if(!sel || lt->arrange != tile || sel->isfloating) | |
return; | |
- for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) | |
- n++; | |
if((c = sel) == nexttiled(clients)) | |
if(!(c = nexttiled(c->next))) | |
return; |