applied dfenze cleanups, fixed some comments in dwm.h
This commit is contained in:
parent
c67dbb28e4
commit
ab3d6a7dfe
14
client.c
14
client.c
@ -152,6 +152,14 @@ focus(Client *c) {
|
|||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
focustopvisible(void) {
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||||
|
focus(c);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
killclient(const char *arg) {
|
killclient(const char *arg) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@ -391,10 +399,8 @@ unmanage(Client *c) {
|
|||||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == c) {
|
if(sel == c)
|
||||||
for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
|
focustopvisible();
|
||||||
focus(nc);
|
|
||||||
}
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(c, WithdrawnState);
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
|
9
dwm.h
9
dwm.h
@ -100,11 +100,12 @@ void attach(Client *c); /* attaches c to global client list */
|
|||||||
void configure(Client *c); /* send synthetic configure event */
|
void configure(Client *c); /* send synthetic configure event */
|
||||||
void detach(Client *c); /* detaches c from global client list */
|
void detach(Client *c); /* detaches c from global client list */
|
||||||
void focus(Client *c); /* focus c, c may be NULL */
|
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 manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
void resize(Client *c, int x, int y,
|
void resize(Client *c, int x, int y,
|
||||||
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
||||||
void togglefloating(const char *arg); /* toggles focused client between floating/tiled state */
|
void togglefloating(const char *arg); /* toggles sel between floating/tiled state */
|
||||||
void updatesizehints(Client *c); /* update the size hint variables of c */
|
void updatesizehints(Client *c); /* update the size hint variables of c */
|
||||||
void updatetitle(Client *c); /* update the name of c */
|
void updatetitle(Client *c); /* update the name of c */
|
||||||
void unmanage(Client *c); /* destroy c */
|
void unmanage(Client *c); /* destroy c */
|
||||||
@ -137,8 +138,8 @@ int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
|||||||
void compileregs(void); /* initialize regexps of rules defined in config.h */
|
void compileregs(void); /* initialize regexps of rules defined in config.h */
|
||||||
Bool isvisible(Client *c); /* returns True if client is visible */
|
Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
void settags(Client *c, Client *trans); /* sets tags of c */
|
void settags(Client *c, Client *trans); /* sets tags of c */
|
||||||
void tag(const char *arg); /* tags c with arg's index */
|
void tag(const char *arg); /* tags sel with arg's index */
|
||||||
void toggletag(const char *arg); /* toggles c tags with arg's index */
|
void toggletag(const char *arg); /* toggles sel tags with arg's index */
|
||||||
void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */
|
void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */
|
||||||
void view(const char *arg); /* views the tag with arg's index */
|
void view(const char *arg); /* views the tag with arg's index */
|
||||||
|
|
||||||
|
3
event.c
3
event.c
@ -247,8 +247,7 @@ enternotify(XEvent *e) {
|
|||||||
focus(c);
|
focus(c);
|
||||||
else if(ev->window == root) {
|
else if(ev->window == root) {
|
||||||
selscreen = True;
|
selscreen = True;
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
focustopvisible();
|
||||||
focus(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
layout.c
15
layout.c
@ -61,10 +61,8 @@ tile(void) {
|
|||||||
c->isbanned = True;
|
c->isbanned = True;
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
}
|
}
|
||||||
if(!sel || !isvisible(sel)) {
|
if(!sel || !isvisible(sel))
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
focustopvisible();
|
||||||
focus(c);
|
|
||||||
}
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,10 +86,8 @@ floating(void) {
|
|||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!sel || !isvisible(sel)) {
|
if(!sel || !isvisible(sel))
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
focustopvisible();
|
||||||
focus(c);
|
|
||||||
}
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,13 +237,10 @@ togglemax(const char *arg) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
zoom(const char *arg) {
|
zoom(const char *arg) {
|
||||||
unsigned int n;
|
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel || lt->arrange != tile || sel->isfloating)
|
if(!sel || lt->arrange != tile || sel->isfloating)
|
||||||
return;
|
return;
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
|
||||||
n++;
|
|
||||||
if((c = sel) == nexttiled(clients))
|
if((c = sel) == nexttiled(clients))
|
||||||
if(!(c = nexttiled(c->next)))
|
if(!(c = nexttiled(c->next)))
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user