applied yiyus tip patch from tue fde58d5e
Anselm R Garbe · 2008-05-29 18:22 1 file(s) · +24 −24
dwm.c +24 −24
53 53
#define MOUSEMASK       (BUTTONMASK|PointerMotionMask)
54 54
#define TAGMASK         ((int)((1LL << LENGTH(tags)) - 1))
55 55
#define TEXTW(x)        (textnw(x, strlen(x)) + dc.font.height)
56 -
#define VISIBLE(x)      ((x)->tags & tagset[seltags])
57 56
58 57
/* enums */
59 58
enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
72 71
	int minax, maxax, minay, maxay;
73 72
	long flags;
74 73
	int bw, oldbw;
75 -
	Bool isbanned, isfixed, isfloating, ismax, isurgent;
74 +
	Bool isbanned, isfixed, isfloating, ismoved, isurgent;
76 75
	uint tags;
77 76
	Client *next;
78 77
	Client *prev;
263 262
	Client *c;
264 263
265 264
	for(c = clients; c; c = c->next)
266 -
		if(VISIBLE(c)) {
267 -
			if(!lt->arrange || c->isfloating)
265 +
		if(c->tags & tagset[seltags]) { /* is visible */
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 271
				resize(c, c->x, c->y, c->w, c->h, True);
272 +
			c->isbanned = False;
269 273
		}
270 274
		else if(!c->isbanned) {
271 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 279
	focus(NULL);
328 332
	}
329 333
	else if((c = getclient(ev->window))) {
330 334
		focus(c);
331 -
		if(CLEANMASK(ev->state) != MODKEY || ismax)
335 +
		if(CLEANMASK(ev->state) != MODKEY || (ismax && !c->isfixed))
332 336
			return;
333 337
		if(ev->button == Button1)
334 338
			movemouse(c);
431 435
			if((ev->value_mask & (CWX|CWY))
432 436
			&& !(ev->value_mask & (CWWidth|CWHeight)))
433 437
				configure(c);
434 -
			if(VISIBLE(c))
438 +
			if(!c->isbanned)
435 439
				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
436 440
		}
437 441
		else
484 488
	Client *c;
485 489
486 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 492
	for(i = 0; i < LENGTH(tags); i++) {
489 493
		dc.w = TEXTW(tags[i]);
490 494
		if(tagset[seltags] & 1 << i) {
515 519
		dc.x = x;
516 520
		if(c) {
517 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 524
		else
521 525
			drawtext(NULL, dc.norm, False);
615 619
616 620
void
617 621
focus(Client *c) {
618 -
	if(!c || (c && !VISIBLE(c)))
619 -
		for(c = stack; c && !VISIBLE(c); c = c->snext);
622 +
	if(!c || (c && c->isbanned))
623 +
		for(c = stack; c && c->isbanned; c = c->snext);
620 624
	if(sel && sel != c) {
621 625
		grabbuttons(sel, False);
622 626
		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
628 632
	}
629 633
	sel = c;
630 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 635
		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
636 636
		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
637 637
	}
654 654
655 655
	if(!sel)
656 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 658
	if(!c)
659 -
		for(c = clients; c && !VISIBLE(c); c = c->next);
659 +
		for(c = clients; c && c->isbanned; c = c->next);
660 660
	if(c) {
661 661
		focus(c);
662 662
		restack();
669 669
670 670
	if(!sel)
671 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 673
	if(!c) {
674 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 677
	if(c) {
678 678
		focus(c);
1027 1027
1028 1028
Client *
1029 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 1031
	return c;
1032 1032
}
1033 1033
1123 1123
		h = bh;
1124 1124
	if(w < bh)
1125 1125
		w = bh;
1126 -
	if(c->x != x || c->y != y || c->w != w || c->h != h || c->isbanned || c->ismax) {
1127 -
		c->isbanned = c->ismax = False;
1126 +
	if(c->x != x || c->y != y || c->w != w || c->h != h || c->ismoved) {
1127 +
		c->isbanned = c->ismoved = False;
1128 1128
		c->x = wc.x = x;
1129 1129
		c->y = wc.y = y;
1130 1130
		c->w = wc.width = w;
1197 1197
		wc.stack_mode = Below;
1198 1198
		wc.sibling = barwin;
1199 1199
		for(c = stack; c; c = c->snext)
1200 -
			if(!c->isfloating && VISIBLE(c)) {
1200 +
			if(!c->isfloating && !c->isbanned) {
1201 1201
				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
1202 1202
				wc.sibling = c->win;
1203 1203
			}
1479 1479
togglefloating(const void *arg) {
1480 1480
	if(!sel)
1481 1481
		return;
1482 -
	sel->isfloating = !sel->isfloating;
1482 +
	sel->isfloating = !sel->isfloating || sel->isfixed;
1483 1483
	if(sel->isfloating)
1484 1484
		resize(sel, sel->x, sel->y, sel->w, sel->h, True);
1485 1485
	arrange();