diff options
| -rw-r--r-- | client.c | 42 | ||||
| -rw-r--r-- | dwm.h | 10 | ||||
| -rw-r--r-- | view.c | 42 |
3 files changed, 47 insertions, 47 deletions
| @@ -61,20 +61,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) { | |||
| 61 | /* extern */ | 61 | /* extern */ |
| 62 | 62 | ||
| 63 | void | 63 | void |
| 64 | attach(Client *c) { | ||
| 65 | if(clients) | ||
| 66 | clients->prev = c; | ||
| 67 | c->next = clients; | ||
| 68 | clients = c; | ||
| 69 | } | ||
| 70 | |||
| 71 | void | ||
| 72 | attachstack(Client *c) { | ||
| 73 | c->snext = stack; | ||
| 74 | stack = c; | ||
| 75 | } | ||
| 76 | |||
| 77 | void | ||
| 78 | configure(Client *c) { | 64 | configure(Client *c) { |
| 79 | XConfigureEvent ce; | 65 | XConfigureEvent ce; |
| 80 | 66 | ||
| @@ -93,24 +79,6 @@ configure(Client *c) { | |||
| 93 | } | 79 | } |
| 94 | 80 | ||
| 95 | void | 81 | void |
| 96 | detach(Client *c) { | ||
| 97 | if(c->prev) | ||
| 98 | c->prev->next = c->next; | ||
| 99 | if(c->next) | ||
| 100 | c->next->prev = c->prev; | ||
| 101 | if(c == clients) | ||
| 102 | clients = c->next; | ||
| 103 | c->next = c->prev = NULL; | ||
| 104 | } | ||
| 105 | |||
| 106 | void | ||
| 107 | detachstack(Client *c) { | ||
| 108 | Client **tc; | ||
| 109 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | ||
| 110 | *tc = c->snext; | ||
| 111 | } | ||
| 112 | |||
| 113 | void | ||
| 114 | focus(Client *c) { | 82 | focus(Client *c) { |
| 115 | if(c && !isvisible(c)) | 83 | if(c && !isvisible(c)) |
| 116 | return; | 84 | return; |
| @@ -135,16 +103,6 @@ focus(Client *c) { | |||
| 135 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | 103 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
| 136 | } | 104 | } |
| 137 | 105 | ||
| 138 | Client * | ||
| 139 | getclient(Window w) { | ||
| 140 | Client *c; | ||
| 141 | |||
| 142 | for(c = clients; c; c = c->next) | ||
| 143 | if(c->win == w) | ||
| 144 | return c; | ||
| 145 | return NULL; | ||
| 146 | } | ||
| 147 | |||
| 148 | Bool | 106 | Bool |
| 149 | isprotodel(Client *c) { | 107 | isprotodel(Client *c) { |
| 150 | int i, n; | 108 | int i, n; |
| @@ -99,13 +99,8 @@ extern Display *dpy; | |||
| 99 | extern Window root, barwin; | 99 | extern Window root, barwin; |
| 100 | 100 | ||
| 101 | /* client.c */ | 101 | /* client.c */ |
| 102 | extern void attach(Client *c); /* attaches c to global client list */ | ||
| 103 | extern void attachstack(Client *c); /* attaches client to stack */ | ||
| 104 | extern void configure(Client *c); /* send synthetic configure event */ | 102 | extern void configure(Client *c); /* send synthetic configure event */ |
| 105 | extern void detach(Client *c); /* detaches c from global client list */ | ||
| 106 | extern void detachstack(Client *c); /* detaches client from stack */ | ||
| 107 | extern void focus(Client *c); /* focus c, c may be NULL */ | 103 | extern void focus(Client *c); /* focus c, c may be NULL */ |
| 108 | extern Client *getclient(Window w); /* return client of w */ | ||
| 109 | extern Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */ | 104 | extern Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */ |
| 110 | extern void killclient(Arg *arg); /* kill c nicely */ | 105 | extern void killclient(Arg *arg); /* kill c nicely */ |
| 111 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 106 | 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 * | |||
| 148 | extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */ | 143 | extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */ |
| 149 | 144 | ||
| 150 | /* view.c */ | 145 | /* view.c */ |
| 146 | extern void attach(Client *c); /* attaches c to global client list */ | ||
| 147 | extern void attachstack(Client *c); /* attaches client to stack */ | ||
| 151 | extern void dofloat(void); /* arranges all windows floating */ | 148 | extern void dofloat(void); /* arranges all windows floating */ |
| 149 | extern void detach(Client *c); /* detaches c from global client list */ | ||
| 150 | extern void detachstack(Client *c); /* detaches client from stack */ | ||
| 152 | extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ | 151 | extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ |
| 153 | extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ | 152 | extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ |
| 153 | extern Client *getclient(Window w); /* return client of w */ | ||
| 154 | extern Bool isvisible(Client *c); /* returns True if client is visible */ | 154 | extern Bool isvisible(Client *c); /* returns True if client is visible */ |
| 155 | extern Client *nextmanaged(Client *c); /* returns managed successor of c */ | 155 | extern Client *nextmanaged(Client *c); /* returns managed successor of c */ |
| 156 | extern void restack(void); /* restores z layers of all clients */ | 156 | extern void restack(void); /* restores z layers of all clients */ |
| @@ -8,6 +8,20 @@ | |||
| 8 | void (*arrange)(void) = DEFMODE; | 8 | void (*arrange)(void) = DEFMODE; |
| 9 | 9 | ||
| 10 | void | 10 | void |
| 11 | attach(Client *c) { | ||
| 12 | if(clients) | ||
| 13 | clients->prev = c; | ||
| 14 | c->next = clients; | ||
| 15 | clients = c; | ||
| 16 | } | ||
| 17 | |||
| 18 | void | ||
| 19 | attachstack(Client *c) { | ||
| 20 | c->snext = stack; | ||
| 21 | stack = c; | ||
| 22 | } | ||
| 23 | |||
| 24 | void | ||
| 11 | dofloat(void) { | 25 | dofloat(void) { |
| 12 | Client *c; | 26 | Client *c; |
| 13 | 27 | ||
| @@ -31,6 +45,24 @@ dofloat(void) { | |||
| 31 | } | 45 | } |
| 32 | 46 | ||
| 33 | void | 47 | void |
| 48 | detach(Client *c) { | ||
| 49 | if(c->prev) | ||
| 50 | c->prev->next = c->next; | ||
| 51 | if(c->next) | ||
| 52 | c->next->prev = c->prev; | ||
| 53 | if(c == clients) | ||
| 54 | clients = c->next; | ||
| 55 | c->next = c->prev = NULL; | ||
| 56 | } | ||
| 57 | |||
| 58 | void | ||
| 59 | detachstack(Client *c) { | ||
| 60 | Client **tc; | ||
| 61 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | ||
| 62 | *tc = c->snext; | ||
| 63 | } | ||
| 64 | |||
| 65 | void | ||
| 34 | focusnext(Arg *arg) { | 66 | focusnext(Arg *arg) { |
| 35 | Client *c; | 67 | Client *c; |
| 36 | 68 | ||
| @@ -62,6 +94,16 @@ focusprev(Arg *arg) { | |||
| 62 | } | 94 | } |
| 63 | } | 95 | } |
| 64 | 96 | ||
| 97 | Client * | ||
| 98 | getclient(Window w) { | ||
| 99 | Client *c; | ||
| 100 | |||
| 101 | for(c = clients; c; c = c->next) | ||
| 102 | if(c->win == w) | ||
| 103 | return c; | ||
| 104 | return NULL; | ||
| 105 | } | ||
| 106 | |||
| 65 | Bool | 107 | Bool |
| 66 | isvisible(Client *c) { | 108 | isvisible(Client *c) { |
| 67 | unsigned int i; | 109 | unsigned int i; |
