diff options
| -rw-r--r-- | client.c | 46 | ||||
| -rw-r--r-- | config.mk | 10 | ||||
| -rw-r--r-- | dwm.h | 3 | ||||
| -rw-r--r-- | tag.c | 7 |
4 files changed, 45 insertions, 21 deletions
| @@ -77,7 +77,6 @@ focusnext(Arg *arg) | |||
| 77 | c = getnext(clients, tsel); | 77 | c = getnext(clients, tsel); |
| 78 | if(c) { | 78 | if(c) { |
| 79 | higher(c); | 79 | higher(c); |
| 80 | c->revert = sel; | ||
| 81 | focus(c); | 80 | focus(c); |
| 82 | } | 81 | } |
| 83 | } | 82 | } |
| @@ -93,7 +92,11 @@ focusprev(Arg *arg) | |||
| 93 | if(sel->ismax) | 92 | if(sel->ismax) |
| 94 | togglemax(NULL); | 93 | togglemax(NULL); |
| 95 | 94 | ||
| 96 | if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) { | 95 | if(!(c = getprev(sel->prev))) { |
| 96 | for(c = clients; c && c->next; c = c->next); | ||
| 97 | c = getprev(c); | ||
| 98 | } | ||
| 99 | if(c) { | ||
| 97 | higher(c); | 100 | higher(c); |
| 98 | focus(c); | 101 | focus(c); |
| 99 | } | 102 | } |
| @@ -127,6 +130,8 @@ gravitate(Client *c, Bool invert) | |||
| 127 | int dx = 0, dy = 0; | 130 | int dx = 0, dy = 0; |
| 128 | 131 | ||
| 129 | switch(c->grav) { | 132 | switch(c->grav) { |
| 133 | default: | ||
| 134 | break; | ||
| 130 | case StaticGravity: | 135 | case StaticGravity: |
| 131 | case NorthWestGravity: | 136 | case NorthWestGravity: |
| 132 | case NorthGravity: | 137 | case NorthGravity: |
| @@ -143,11 +148,11 @@ gravitate(Client *c, Bool invert) | |||
| 143 | case SouthWestGravity: | 148 | case SouthWestGravity: |
| 144 | dy = -(c->h); | 149 | dy = -(c->h); |
| 145 | break; | 150 | break; |
| 146 | default: | ||
| 147 | break; | ||
| 148 | } | 151 | } |
| 149 | 152 | ||
| 150 | switch (c->grav) { | 153 | switch (c->grav) { |
| 154 | default: | ||
| 155 | break; | ||
| 151 | case StaticGravity: | 156 | case StaticGravity: |
| 152 | case NorthWestGravity: | 157 | case NorthWestGravity: |
| 153 | case WestGravity: | 158 | case WestGravity: |
| @@ -164,8 +169,6 @@ gravitate(Client *c, Bool invert) | |||
| 164 | case SouthEastGravity: | 169 | case SouthEastGravity: |
| 165 | dx = -(c->w + c->border); | 170 | dx = -(c->w + c->border); |
| 166 | break; | 171 | break; |
| 167 | default: | ||
| 168 | break; | ||
| 169 | } | 172 | } |
| 170 | 173 | ||
| 171 | if(invert) { | 174 | if(invert) { |
| @@ -204,7 +207,6 @@ lower(Client *c) | |||
| 204 | void | 207 | void |
| 205 | manage(Window w, XWindowAttributes *wa) | 208 | manage(Window w, XWindowAttributes *wa) |
| 206 | { | 209 | { |
| 207 | int diff; | ||
| 208 | Client *c; | 210 | Client *c; |
| 209 | Window trans; | 211 | Window trans; |
| 210 | XSetWindowAttributes twa; | 212 | XSetWindowAttributes twa; |
| @@ -224,7 +226,7 @@ manage(Window w, XWindowAttributes *wa) | |||
| 224 | c->proto = getproto(c->win); | 226 | c->proto = getproto(c->win); |
| 225 | setsize(c); | 227 | setsize(c); |
| 226 | XSelectInput(dpy, c->win, | 228 | XSelectInput(dpy, c->win, |
| 227 | StructureNotifyMask | PropertyChangeMask | EnterWindowMask); | 229 | StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
| 228 | XGetTransientForHint(dpy, c->win, &trans); | 230 | XGetTransientForHint(dpy, c->win, &trans); |
| 229 | twa.override_redirect = 1; | 231 | twa.override_redirect = 1; |
| 230 | twa.background_pixmap = ParentRelative; | 232 | twa.background_pixmap = ParentRelative; |
| @@ -237,6 +239,8 @@ manage(Window w, XWindowAttributes *wa) | |||
| 237 | 239 | ||
| 238 | settags(c); | 240 | settags(c); |
| 239 | 241 | ||
| 242 | if(clients) | ||
| 243 | clients->prev = c; | ||
| 240 | c->next = clients; | 244 | c->next = clients; |
| 241 | clients = c; | 245 | clients = c; |
| 242 | 246 | ||
| @@ -264,6 +268,7 @@ manage(Window w, XWindowAttributes *wa) | |||
| 264 | else { | 268 | else { |
| 265 | XMapRaised(dpy, c->win); | 269 | XMapRaised(dpy, c->win); |
| 266 | XMapRaised(dpy, c->title); | 270 | XMapRaised(dpy, c->title); |
| 271 | |||
| 267 | } | 272 | } |
| 268 | } | 273 | } |
| 269 | 274 | ||
| @@ -273,9 +278,15 @@ pop(Client *c) | |||
| 273 | Client **l; | 278 | Client **l; |
| 274 | 279 | ||
| 275 | for(l = &clients; *l && *l != c; l = &(*l)->next); | 280 | for(l = &clients; *l && *l != c; l = &(*l)->next); |
| 281 | if(c->prev) | ||
| 282 | c->prev->next = c->next; | ||
| 283 | if(c->next) | ||
| 284 | c->next->prev = c->prev; | ||
| 276 | *l = c->next; | 285 | *l = c->next; |
| 277 | 286 | ||
| 278 | c->next = clients; /* pop */ | 287 | if(clients) |
| 288 | clients->prev = c; | ||
| 289 | c->next = clients; | ||
| 279 | clients = c; | 290 | clients = c; |
| 280 | arrange(NULL); | 291 | arrange(NULL); |
| 281 | } | 292 | } |
| @@ -439,13 +450,18 @@ unmanage(Client *c) | |||
| 439 | XDestroyWindow(dpy, c->title); | 450 | XDestroyWindow(dpy, c->title); |
| 440 | 451 | ||
| 441 | for(l = &clients; *l && *l != c; l = &(*l)->next); | 452 | for(l = &clients; *l && *l != c; l = &(*l)->next); |
| 453 | if(c->prev) | ||
| 454 | c->prev->next = c->next; | ||
| 455 | if(c->next) | ||
| 456 | c->next->prev = c->prev; | ||
| 442 | *l = c->next; | 457 | *l = c->next; |
| 443 | for(l = &clients; *l; l = &(*l)->next) | 458 | if(sel == c) { |
| 444 | if((*l)->revert == c) | 459 | sel = getnext(c->next, tsel); |
| 445 | (*l)->revert = NULL; | 460 | if(!sel) |
| 446 | if(sel == c) | 461 | sel = getprev(c->prev); |
| 447 | sel = sel->revert ? sel->revert : clients; | 462 | if(!sel) |
| 448 | 463 | sel = clients; | |
| 464 | } | ||
| 449 | free(c); | 465 | free(c); |
| 450 | 466 | ||
| 451 | XSync(dpy, False); | 467 | XSync(dpy, False); |
| @@ -13,12 +13,12 @@ VERSION = 0.5 | |||
| 13 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 | 13 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 |
| 14 | 14 | ||
| 15 | # Linux/BSD | 15 | # Linux/BSD |
| 16 | CFLAGS = -O3 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ | 16 | #CFLAGS = -O3 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ |
| 17 | -DVERSION=\"${VERSION}\" | ||
| 18 | LDFLAGS = ${LIBS} | ||
| 19 | #CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ | ||
| 20 | # -DVERSION=\"${VERSION}\" | 17 | # -DVERSION=\"${VERSION}\" |
| 21 | #LDFLAGS = -g ${LIBS} | 18 | #LDFLAGS = ${LIBS} |
| 19 | CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ | ||
| 20 | -DVERSION=\"${VERSION}\" | ||
| 21 | LDFLAGS = -g ${LIBS} | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | # Solaris | 24 | # Solaris |
| @@ -76,7 +76,7 @@ struct Client { | |||
| 76 | Bool isfloat; | 76 | Bool isfloat; |
| 77 | Bool ismax; | 77 | Bool ismax; |
| 78 | Client *next; | 78 | Client *next; |
| 79 | Client *revert; | 79 | Client *prev; |
| 80 | Window win; | 80 | Window win; |
| 81 | Window title; | 81 | Window title; |
| 82 | }; | 82 | }; |
| @@ -135,6 +135,7 @@ extern void appendtag(Arg *arg); | |||
| 135 | extern void dofloat(Arg *arg); | 135 | extern void dofloat(Arg *arg); |
| 136 | extern void dotile(Arg *arg); | 136 | extern void dotile(Arg *arg); |
| 137 | extern Client *getnext(Client *c, unsigned int t); | 137 | extern Client *getnext(Client *c, unsigned int t); |
| 138 | extern Client *getprev(Client *c); | ||
| 138 | extern void heretag(Arg *arg); | 139 | extern void heretag(Arg *arg); |
| 139 | extern void replacetag(Arg *arg); | 140 | extern void replacetag(Arg *arg); |
| 140 | extern void settags(Client *c); | 141 | extern void settags(Client *c); |
| @@ -140,6 +140,13 @@ getnext(Client *c, unsigned int t) | |||
| 140 | return c; | 140 | return c; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | Client * | ||
| 144 | getprev(Client *c) | ||
| 145 | { | ||
| 146 | for(; c && !c->tags[tsel]; c = c->prev); | ||
| 147 | return c; | ||
| 148 | } | ||
| 149 | |||
| 143 | void | 150 | void |
| 144 | heretag(Arg *arg) | 151 | heretag(Arg *arg) |
| 145 | { | 152 | { |
