about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2009-06-20 15:51:34 +0100
committerAnselm R Garbe <anselm@garbe.us>2009-06-20 15:51:34 +0100
commit3da24539976b4474862415606f641d0f69336729 (patch)
tree22abfe616f488d2c07a813b4dafaa16281909389
parent2ce37bc69ee72af7ea88376c73133f8a833204cf (diff)
downloaddwm-3da24539976b4474862415606f641d0f69336729.tar.gz
several fixes through ISVISIBLE change (takes Monitor into account)
-rw-r--r--dwm.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/dwm.c b/dwm.c
index 0e8c927..6084123 100644
--- a/dwm.c
+++ b/dwm.c
@@ -44,8 +44,8 @@
 #define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask)
 #define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask))
 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
-#define ISVISIBLE(x)            (x->tags & tagset[mon[x->mon].seltags])
-#define LENGTH(x)               (sizeof x / sizeof x[0])
+#define ISVISIBLE(M, C)         ((M) == (&mon[C->mon]) && (C->tags & tagset[M->seltags]))
+#define LENGTH(X)               (sizeof X / sizeof X[0])
 #define MAX(a, b)               ((a) > (b) ? (a) : (b))
 #define MIN(a, b)               ((a) < (b) ? (a) : (b))
 #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
@@ -493,7 +493,7 @@ configurenotify(XEvent *e) {
 		updategeom();
 		if(dc.drawable != 0)
 			XFreePixmap(dpy, dc.drawable);
-		dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
+		dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
 		for(i = 0; i < nmons; i++)
 			XMoveResizeWindow(dpy, mon[i].barwin, mon[i].wx, mon[i].by, mon[i].ww, bh);
 		arrange();
@@ -524,7 +524,7 @@ configurerequest(XEvent *e) {
 				c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */
 			if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
 				configure(c);
-			if(ISVISIBLE(c))
+			if(ISVISIBLE((&mon[c->mon]), c))
 				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
 		}
 		else
@@ -636,6 +636,7 @@ drawbar(Monitor *m) {
 		}
 	}
 	else {
+		dc.x = x;
 		dc.w = m->ww - x;
 		drawtext(NULL, dc.norm, False);
 	}
@@ -718,17 +719,18 @@ expose(XEvent *e) {
 	unsigned int i;
 	XExposeEvent *ev = &e->xexpose;
 
-	for(i = 0; i < nmons; i++)
-		if(ev->count == 0 && (ev->window == mon[i].barwin)) {
-			drawbar(&mon[i]);
-			break;
-		}
+	if(ev->count == 0)
+		for(i = 0; i < nmons; i++)
+			if(ev->window == mon[i].barwin) {
+				drawbar(&mon[i]);
+				break;
+			}
 }
 
 void
 focus(Client *c) {
-	if(!c || !ISVISIBLE(c))
-		for(c = stack; c && !ISVISIBLE(c); c = c->snext);
+	if(!c || !ISVISIBLE((&mon[c->mon]), c))
+		for(c = stack; c && !ISVISIBLE(selmon, c); c = c->snext);
 	if(sel && sel != c) {
 		grabbuttons(sel, False);
 		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -776,17 +778,17 @@ focusstack(const Arg *arg) {
 	if(!sel)
 		return;
 	if(arg->i > 0) {
-		for(c = sel->next; c && !ISVISIBLE(c); c = c->next);
+		for(c = sel->next; c && !ISVISIBLE(selmon, c); c = c->next);
 		if(!c)
-			for(c = clients; c && !ISVISIBLE(c); c = c->next);
+			for(c = clients; c && !ISVISIBLE(selmon, c); c = c->next);
 	}
 	else {
 		for(i = clients; i != sel; i = i->next)
-			if(ISVISIBLE(i))
+			if(ISVISIBLE(selmon, i))
 				c = i;
 		if(!c)
 			for(; i; i = i->next)
-				if(ISVISIBLE(i))
+				if(ISVISIBLE(selmon, i))
 					c = i;
 	}
 	if(c) {
@@ -1126,7 +1128,7 @@ movemouse(const Arg *arg) {
 Client *
 nexttiled(Monitor *m, Client *c) {
 	// TODO: m handling
-	for(; c && (c->isfloating || m != &mon[c->mon] || !ISVISIBLE(c)); c = c->next);
+	for(; c && (c->isfloating || !ISVISIBLE(m, c)); c = c->next);
 	return c;
 }
 
@@ -1246,7 +1248,7 @@ restack(Monitor *m) {
 		wc.stack_mode = Below;
 		wc.sibling = m->barwin;
 		for(c = stack; c; c = c->snext)
-			if(!c->isfloating && m == &mon[c->mon] && ISVISIBLE(c)) {
+			if(!c->isfloating && ISVISIBLE(m, c)) {
 				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
 				wc.sibling = c->win;
 			}
@@ -1408,7 +1410,7 @@ void
 showhide(Client *c) {
 	if(!c)
 		return;
-	if(ISVISIBLE(c)) { /* show clients top down */
+	if(ISVISIBLE((&mon[c->mon]), c)) { /* show clients top down */
 		XMoveWindow(dpy, c->win, c->x, c->y);
 		if(!lt[selmon->sellt]->arrange || c->isfloating)
 			resize(c, c->x, c->y, c->w, c->h);
> 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610