some more refactoring
This commit is contained in:
parent
30af19d442
commit
b3d7e07f18
42
client.c
42
client.c
@ -60,20 +60,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
|
|||||||
|
|
||||||
/* extern */
|
/* 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
|
void
|
||||||
configure(Client *c) {
|
configure(Client *c) {
|
||||||
XConfigureEvent ce;
|
XConfigureEvent ce;
|
||||||
@ -92,24 +78,6 @@ configure(Client *c) {
|
|||||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
void
|
||||||
focus(Client *c) {
|
focus(Client *c) {
|
||||||
if(c && !isvisible(c))
|
if(c && !isvisible(c))
|
||||||
@ -135,16 +103,6 @@ focus(Client *c) {
|
|||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
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
|
Bool
|
||||||
isprotodel(Client *c) {
|
isprotodel(Client *c) {
|
||||||
int i, n;
|
int i, n;
|
||||||
|
10
dwm.h
10
dwm.h
@ -99,13 +99,8 @@ extern Display *dpy;
|
|||||||
extern Window root, barwin;
|
extern Window root, barwin;
|
||||||
|
|
||||||
/* client.c */
|
/* 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 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 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 Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */
|
||||||
extern void killclient(Arg *arg); /* kill c nicely */
|
extern void killclient(Arg *arg); /* kill c nicely */
|
||||||
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
@ -148,9 +143,14 @@ extern void eprint(const char *errstr, ...); /* prints errstr and exits with 1 *
|
|||||||
extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */
|
extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */
|
||||||
|
|
||||||
/* view.c */
|
/* 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 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 focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
||||||
extern void focusprev(Arg *arg); /* focuses previous 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 Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
extern Client *nextmanaged(Client *c); /* returns managed successor of c */
|
extern Client *nextmanaged(Client *c); /* returns managed successor of c */
|
||||||
extern void restack(void); /* restores z layers of all clients */
|
extern void restack(void); /* restores z layers of all clients */
|
||||||
|
42
view.c
42
view.c
@ -7,6 +7,20 @@
|
|||||||
|
|
||||||
void (*arrange)(void) = DEFMODE;
|
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
|
void
|
||||||
dofloat(void) {
|
dofloat(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
@ -30,6 +44,24 @@ dofloat(void) {
|
|||||||
restack();
|
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
|
void
|
||||||
focusnext(Arg *arg) {
|
focusnext(Arg *arg) {
|
||||||
Client *c;
|
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
|
Bool
|
||||||
isvisible(Client *c) {
|
isvisible(Client *c) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user