diff options
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 48 |
1 files changed, 24 insertions, 24 deletions
| @@ -53,7 +53,6 @@ | |||
| 53 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) | 53 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) |
| 54 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) | 54 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) |
| 55 | #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) | 55 | #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) |
| 56 | #define VISIBLE(x) ((x)->tags & tagset[seltags]) | ||
| 57 | 56 | ||
| 58 | /* enums */ | 57 | /* enums */ |
| 59 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | 58 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
| @@ -72,7 +71,7 @@ struct Client { | |||
| 72 | int minax, maxax, minay, maxay; | 71 | int minax, maxax, minay, maxay; |
| 73 | long flags; | 72 | long flags; |
| 74 | int bw, oldbw; | 73 | int bw, oldbw; |
| 75 | Bool isbanned, isfixed, isfloating, ismax, isurgent; | 74 | Bool isbanned, isfixed, isfloating, ismoved, isurgent; |
| 76 | uint tags; | 75 | uint tags; |
| 77 | Client *next; | 76 | Client *next; |
| 78 | Client *prev; | 77 | Client *prev; |
| @@ -263,13 +262,18 @@ arrange(void) { | |||
| 263 | Client *c; | 262 | Client *c; |
| 264 | 263 | ||
| 265 | for(c = clients; c; c = c->next) | 264 | for(c = clients; c; c = c->next) |
| 266 | if(VISIBLE(c)) { | 265 | if(c->tags & tagset[seltags]) { /* is visible */ |
| 267 | if(!lt->arrange || c->isfloating) | 266 | if(ismax && !c->isfixed) { |
| 267 | XMoveResizeWindow(dpy, c->win, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw); | ||
| 268 | c->ismoved = True; | ||
| 269 | } | ||
| 270 | else if(!lt->arrange || c->isfloating) | ||
| 268 | resize(c, c->x, c->y, c->w, c->h, True); | 271 | resize(c, c->x, c->y, c->w, c->h, True); |
| 272 | c->isbanned = False; | ||
| 269 | } | 273 | } |
| 270 | else if(!c->isbanned) { | 274 | else if(!c->isbanned) { |
| 271 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 275 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
| 272 | c->isbanned = True; | 276 | c->isbanned = c->ismoved = True; |
| 273 | } | 277 | } |
| 274 | 278 | ||
| 275 | focus(NULL); | 279 | focus(NULL); |
| @@ -328,7 +332,7 @@ buttonpress(XEvent *e) { | |||
| 328 | } | 332 | } |
| 329 | else if((c = getclient(ev->window))) { | 333 | else if((c = getclient(ev->window))) { |
| 330 | focus(c); | 334 | focus(c); |
| 331 | if(CLEANMASK(ev->state) != MODKEY || ismax) | 335 | if(CLEANMASK(ev->state) != MODKEY || (ismax && !c->isfixed)) |
| 332 | return; | 336 | return; |
| 333 | if(ev->button == Button1) | 337 | if(ev->button == Button1) |
| 334 | movemouse(c); | 338 | movemouse(c); |
| @@ -431,7 +435,7 @@ configurerequest(XEvent *e) { | |||
| 431 | if((ev->value_mask & (CWX|CWY)) | 435 | if((ev->value_mask & (CWX|CWY)) |
| 432 | && !(ev->value_mask & (CWWidth|CWHeight))) | 436 | && !(ev->value_mask & (CWWidth|CWHeight))) |
| 433 | configure(c); | 437 | configure(c); |
| 434 | if(VISIBLE(c)) | 438 | if(!c->isbanned) |
| 435 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); | 439 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
| 436 | } | 440 | } |
| 437 | else | 441 | else |
| @@ -484,7 +488,7 @@ drawbar(void) { | |||
| 484 | Client *c; | 488 | Client *c; |
| 485 | 489 | ||
| 486 | dc.x = 0; | 490 | dc.x = 0; |
| 487 | for(c = stack; c && !VISIBLE(c); c = c->snext); | 491 | for(c = stack; c && c->isbanned; c = c->snext); |
| 488 | for(i = 0; i < LENGTH(tags); i++) { | 492 | for(i = 0; i < LENGTH(tags); i++) { |
| 489 | dc.w = TEXTW(tags[i]); | 493 | dc.w = TEXTW(tags[i]); |
| 490 | if(tagset[seltags] & 1 << i) { | 494 | if(tagset[seltags] & 1 << i) { |
| @@ -515,7 +519,7 @@ drawbar(void) { | |||
| 515 | dc.x = x; | 519 | dc.x = x; |
| 516 | if(c) { | 520 | if(c) { |
| 517 | drawtext(c->name, dc.sel, False); | 521 | drawtext(c->name, dc.sel, False); |
| 518 | drawsquare(False, c->isfloating, False, dc.sel); | 522 | drawsquare(c->isfixed, c->isfloating, False, dc.sel); |
| 519 | } | 523 | } |
| 520 | else | 524 | else |
| 521 | drawtext(NULL, dc.norm, False); | 525 | drawtext(NULL, dc.norm, False); |
| @@ -615,8 +619,8 @@ expose(XEvent *e) { | |||
| 615 | 619 | ||
| 616 | void | 620 | void |
| 617 | focus(Client *c) { | 621 | focus(Client *c) { |
| 618 | if(!c || (c && !VISIBLE(c))) | 622 | if(!c || (c && c->isbanned)) |
| 619 | for(c = stack; c && !VISIBLE(c); c = c->snext); | 623 | for(c = stack; c && c->isbanned; c = c->snext); |
| 620 | if(sel && sel != c) { | 624 | if(sel && sel != c) { |
| 621 | grabbuttons(sel, False); | 625 | grabbuttons(sel, False); |
| 622 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); | 626 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
| @@ -628,10 +632,6 @@ focus(Client *c) { | |||
| 628 | } | 632 | } |
| 629 | sel = c; | 633 | sel = c; |
| 630 | if(c) { | 634 | if(c) { |
| 631 | if(ismax) { | ||
| 632 | XMoveResizeWindow(dpy, c->win, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw); | ||
| 633 | c->ismax = True; | ||
| 634 | } | ||
| 635 | XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); | 635 | XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); |
| 636 | XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 636 | XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
| 637 | } | 637 | } |
| @@ -654,9 +654,9 @@ focusnext(const void *arg) { | |||
| 654 | 654 | ||
| 655 | if(!sel) | 655 | if(!sel) |
| 656 | return; | 656 | return; |
| 657 | for(c = sel->next; c && !VISIBLE(c); c = c->next); | 657 | for(c = sel->next; c && c->isbanned; c = c->next); |
| 658 | if(!c) | 658 | if(!c) |
| 659 | for(c = clients; c && !VISIBLE(c); c = c->next); | 659 | for(c = clients; c && c->isbanned; c = c->next); |
| 660 | if(c) { | 660 | if(c) { |
| 661 | focus(c); | 661 | focus(c); |
| 662 | restack(); | 662 | restack(); |
| @@ -669,10 +669,10 @@ focusprev(const void *arg) { | |||
| 669 | 669 | ||
| 670 | if(!sel) | 670 | if(!sel) |
| 671 | return; | 671 | return; |
| 672 | for(c = sel->prev; c && !VISIBLE(c); c = c->prev); | 672 | for(c = sel->prev; c && c->isbanned; c = c->prev); |
| 673 | if(!c) { | 673 | if(!c) { |
| 674 | for(c = clients; c && c->next; c = c->next); | 674 | for(c = clients; c && c->next; c = c->next); |
| 675 | for(; c && !VISIBLE(c); c = c->prev); | 675 | for(; c && c->isbanned; c = c->prev); |
| 676 | } | 676 | } |
| 677 | if(c) { | 677 | if(c) { |
| 678 | focus(c); | 678 | focus(c); |
| @@ -1027,7 +1027,7 @@ movemouse(Client *c) { | |||
| 1027 | 1027 | ||
| 1028 | Client * | 1028 | Client * |
| 1029 | nexttiled(Client *c) { | 1029 | nexttiled(Client *c) { |
| 1030 | for(; c && (c->isfloating || !VISIBLE(c)); c = c->next); | 1030 | for(; c && (c->isfloating || c->isbanned); c = c->next); |
| 1031 | return c; | 1031 | return c; |
| 1032 | } | 1032 | } |
| 1033 | 1033 | ||
| @@ -1123,8 +1123,8 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { | |||
| 1123 | h = bh; | 1123 | h = bh; |
| 1124 | if(w < bh) | 1124 | if(w < bh) |
| 1125 | w = bh; | 1125 | w = bh; |
| 1126 | if(c->x != x || c->y != y || c->w != w || c->h != h || c->isbanned || c->ismax) { | 1126 | if(c->x != x || c->y != y || c->w != w || c->h != h || c->ismoved) { |
| 1127 | c->isbanned = c->ismax = False; | 1127 | c->isbanned = c->ismoved = False; |
| 1128 | c->x = wc.x = x; | 1128 | c->x = wc.x = x; |
| 1129 | c->y = wc.y = y; | 1129 | c->y = wc.y = y; |
| 1130 | c->w = wc.width = w; | 1130 | c->w = wc.width = w; |
| @@ -1197,7 +1197,7 @@ restack(void) { | |||
| 1197 | wc.stack_mode = Below; | 1197 | wc.stack_mode = Below; |
| 1198 | wc.sibling = barwin; | 1198 | wc.sibling = barwin; |
| 1199 | for(c = stack; c; c = c->snext) | 1199 | for(c = stack; c; c = c->snext) |
| 1200 | if(!c->isfloating && VISIBLE(c)) { | 1200 | if(!c->isfloating && !c->isbanned) { |
| 1201 | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); | 1201 | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
| 1202 | wc.sibling = c->win; | 1202 | wc.sibling = c->win; |
| 1203 | } | 1203 | } |
| @@ -1479,7 +1479,7 @@ void | |||
| 1479 | togglefloating(const void *arg) { | 1479 | togglefloating(const void *arg) { |
| 1480 | if(!sel) | 1480 | if(!sel) |
| 1481 | return; | 1481 | return; |
| 1482 | sel->isfloating = !sel->isfloating; | 1482 | sel->isfloating = !sel->isfloating || sel->isfixed; |
| 1483 | if(sel->isfloating) | 1483 | if(sel->isfloating) |
| 1484 | resize(sel, sel->x, sel->y, sel->w, sel->h, True); | 1484 | resize(sel, sel->x, sel->y, sel->w, sel->h, True); |
| 1485 | arrange(); | 1485 | arrange(); |
