diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-02-21 11:39:57 +0100 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-02-21 11:39:57 +0100 |
| commit | 29c26b88e7333fb8ea022c4bb4277bc0394ab9e3 (patch) | |
| tree | f48255b650c9b8ecf252a2b6a5b0ca10b4158780 | |
| parent | cleaned up and commented the config.*.h (diff) | |
| download | dwm-29c26b88e7333fb8ea022c4bb4277bc0394ab9e3.tar.gz dwm-29c26b88e7333fb8ea022c4bb4277bc0394ab9e3.zip | |
moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific)
| -rw-r--r-- | client.c | 46 | ||||
| -rw-r--r-- | dwm.h | 8 | ||||
| -rw-r--r-- | layout.c | 46 |
3 files changed, 50 insertions, 50 deletions
| @@ -171,38 +171,6 @@ focus(Client *c) { | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void | 173 | void |
| 174 | focusnext(Arg *arg) { | ||
| 175 | Client *c; | ||
| 176 | |||
| 177 | if(!sel) | ||
| 178 | return; | ||
| 179 | for(c = sel->next; c && !isvisible(c); c = c->next); | ||
| 180 | if(!c) | ||
| 181 | for(c = clients; c && !isvisible(c); c = c->next); | ||
| 182 | if(c) { | ||
| 183 | focus(c); | ||
| 184 | restack(); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 188 | void | ||
| 189 | focusprev(Arg *arg) { | ||
| 190 | Client *c; | ||
| 191 | |||
| 192 | if(!sel) | ||
| 193 | return; | ||
| 194 | for(c = sel->prev; c && !isvisible(c); c = c->prev); | ||
| 195 | if(!c) { | ||
| 196 | for(c = clients; c && c->next; c = c->next); | ||
| 197 | for(; c && !isvisible(c); c = c->prev); | ||
| 198 | } | ||
| 199 | if(c) { | ||
| 200 | focus(c); | ||
| 201 | restack(); | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | void | ||
| 206 | killclient(Arg *arg) { | 174 | killclient(Arg *arg) { |
| 207 | if(!sel) | 175 | if(!sel) |
| 208 | return; | 176 | return; |
| @@ -266,12 +234,6 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 266 | lt->arrange(); | 234 | lt->arrange(); |
| 267 | } | 235 | } |
| 268 | 236 | ||
| 269 | Client * | ||
| 270 | nexttiled(Client *c) { | ||
| 271 | for(; c && (c->isversatile || !isvisible(c)); c = c->next); | ||
| 272 | return c; | ||
| 273 | } | ||
| 274 | |||
| 275 | void | 237 | void |
| 276 | resize(Client *c, int x, int y, int w, int h, Bool sizehints) { | 238 | resize(Client *c, int x, int y, int w, int h, Bool sizehints) { |
| 277 | float actual, dx, dy, max, min; | 239 | float actual, dx, dy, max, min; |
| @@ -341,6 +303,14 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { | |||
| 341 | } | 303 | } |
| 342 | 304 | ||
| 343 | void | 305 | void |
| 306 | toggleversatile(Arg *arg) { | ||
| 307 | if(!sel || lt->arrange == versatile) | ||
| 308 | return; | ||
| 309 | sel->isversatile = !sel->isversatile; | ||
| 310 | lt->arrange(); | ||
| 311 | } | ||
| 312 | |||
| 313 | void | ||
| 344 | updatesizehints(Client *c) { | 314 | updatesizehints(Client *c) { |
| 345 | long msize; | 315 | long msize; |
| 346 | XSizeHints size; | 316 | XSizeHints size; |
| @@ -105,13 +105,11 @@ extern Window root, barwin; | |||
| 105 | /* client.c */ | 105 | /* client.c */ |
| 106 | extern void configure(Client *c); /* send synthetic configure event */ | 106 | extern void configure(Client *c); /* send synthetic configure event */ |
| 107 | extern void focus(Client *c); /* focus c, c may be NULL */ | 107 | extern void focus(Client *c); /* focus c, c may be NULL */ |
| 108 | extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ | ||
| 109 | extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ | ||
| 110 | extern void killclient(Arg *arg); /* kill c nicely */ | 108 | extern void killclient(Arg *arg); /* kill c nicely */ |
| 111 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 109 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
| 112 | extern Client *nexttiled(Client *c); /* returns tiled successor of c */ | ||
| 113 | extern void resize(Client *c, int x, int y, | 110 | extern void resize(Client *c, int x, int y, |
| 114 | int w, int h, Bool sizehints); /* resize with given coordinates c*/ | 111 | int w, int h, Bool sizehints); /* resize with given coordinates c*/ |
| 112 | extern void toggleversatile(Arg *arg); /* toggles focused client between versatile/and non-versatile state */ | ||
| 115 | extern void updatesizehints(Client *c); /* update the size hint variables of c */ | 113 | extern void updatesizehints(Client *c); /* update the size hint variables of c */ |
| 116 | extern void updatetitle(Client *c); /* update the name of c */ | 114 | extern void updatetitle(Client *c); /* update the name of c */ |
| 117 | extern void unmanage(Client *c); /* destroy c */ | 115 | extern void unmanage(Client *c); /* destroy c */ |
| @@ -127,12 +125,14 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/ | |||
| 127 | extern void grabkeys(void); /* grab all keys defined in config.h */ | 125 | extern void grabkeys(void); /* grab all keys defined in config.h */ |
| 128 | 126 | ||
| 129 | /* layout.c */ | 127 | /* layout.c */ |
| 128 | extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ | ||
| 129 | extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ | ||
| 130 | extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ | 130 | extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ |
| 131 | extern void initlayouts(void); /* initialize layout array */ | 131 | extern void initlayouts(void); /* initialize layout array */ |
| 132 | extern Client *nexttiled(Client *c); /* returns tiled successor of c */ | ||
| 132 | extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ | 133 | extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */ |
| 133 | extern void restack(void); /* restores z layers of all clients */ | 134 | extern void restack(void); /* restores z layers of all clients */ |
| 134 | extern void setlayout(Arg *arg); /* sets layout, -1 toggles */ | 135 | extern void setlayout(Arg *arg); /* sets layout, -1 toggles */ |
| 135 | extern void toggleversatile(Arg *arg); /* toggles focusesd client between versatile/and non-versatile state */ | ||
| 136 | extern void versatile(void); /* arranges all windows versatile */ | 136 | extern void versatile(void); /* arranges all windows versatile */ |
| 137 | 137 | ||
| 138 | /* main.c */ | 138 | /* main.c */ |
| @@ -69,6 +69,38 @@ LAYOUTS | |||
| 69 | /* extern */ | 69 | /* extern */ |
| 70 | 70 | ||
| 71 | void | 71 | void |
| 72 | focusnext(Arg *arg) { | ||
| 73 | Client *c; | ||
| 74 | |||
| 75 | if(!sel) | ||
| 76 | return; | ||
| 77 | for(c = sel->next; c && !isvisible(c); c = c->next); | ||
| 78 | if(!c) | ||
| 79 | for(c = clients; c && !isvisible(c); c = c->next); | ||
| 80 | if(c) { | ||
| 81 | focus(c); | ||
| 82 | restack(); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | void | ||
| 87 | focusprev(Arg *arg) { | ||
| 88 | Client *c; | ||
| 89 | |||
| 90 | if(!sel) | ||
| 91 | return; | ||
| 92 | for(c = sel->prev; c && !isvisible(c); c = c->prev); | ||
| 93 | if(!c) { | ||
| 94 | for(c = clients; c && c->next; c = c->next); | ||
| 95 | for(; c && !isvisible(c); c = c->prev); | ||
| 96 | } | ||
| 97 | if(c) { | ||
| 98 | focus(c); | ||
| 99 | restack(); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | void | ||
| 72 | incnmaster(Arg *arg) { | 104 | incnmaster(Arg *arg) { |
| 73 | if((lt->arrange != tile) || (nmaster + arg->i < 1) | 105 | if((lt->arrange != tile) || (nmaster + arg->i < 1) |
| 74 | || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) | 106 | || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) |
| @@ -93,6 +125,12 @@ initlayouts(void) { | |||
| 93 | } | 125 | } |
| 94 | } | 126 | } |
| 95 | 127 | ||
| 128 | Client * | ||
| 129 | nexttiled(Client *c) { | ||
| 130 | for(; c && (c->isversatile || !isvisible(c)); c = c->next); | ||
| 131 | return c; | ||
| 132 | } | ||
| 133 | |||
| 96 | void | 134 | void |
| 97 | resizemaster(Arg *arg) { | 135 | resizemaster(Arg *arg) { |
| 98 | if(lt->arrange != tile) | 136 | if(lt->arrange != tile) |
| @@ -154,14 +192,6 @@ setlayout(Arg *arg) { | |||
| 154 | } | 192 | } |
| 155 | 193 | ||
| 156 | void | 194 | void |
| 157 | toggleversatile(Arg *arg) { | ||
| 158 | if(!sel || lt->arrange == versatile) | ||
| 159 | return; | ||
| 160 | sel->isversatile = !sel->isversatile; | ||
| 161 | lt->arrange(); | ||
| 162 | } | ||
| 163 | |||
| 164 | void | ||
| 165 | versatile(void) { | 195 | versatile(void) { |
| 166 | Client *c; | 196 | Client *c; |
| 167 | 197 | ||
