about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-21 11:39:57 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-21 11:39:57 +0100
commit29c26b88e7333fb8ea022c4bb4277bc0394ab9e3 (patch)
treef48255b650c9b8ecf252a2b6a5b0ca10b4158780
parentf196b71e4d543e7d8c4fd6398cf1bedd3dafc024 (diff)
downloaddwm-29c26b88e7333fb8ea022c4bb4277bc0394ab9e3.tar.gz
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.c46
-rw-r--r--dwm.h8
-rw-r--r--layout.c46
3 files changed, 50 insertions, 50 deletions
diff --git a/client.c b/client.c
index fdb973c..c962c39 100644
--- a/client.c
+++ b/client.c
@@ -171,38 +171,6 @@ focus(Client *c) {
 }
 
 void
-focusnext(Arg *arg) {
-	Client *c;
-   
-	if(!sel)
-		return;
-	for(c = sel->next; c && !isvisible(c); c = c->next);
-	if(!c)
-		for(c = clients; c && !isvisible(c); c = c->next);
-	if(c) {
-		focus(c);
-		restack();
-	}
-}
-
-void
-focusprev(Arg *arg) {
-	Client *c;
-
-	if(!sel)
-		return;
-	for(c = sel->prev; c && !isvisible(c); c = c->prev);
-	if(!c) {
-		for(c = clients; c && c->next; c = c->next);
-		for(; c && !isvisible(c); c = c->prev);
-	}
-	if(c) {
-		focus(c);
-		restack();
-	}
-}
-
-void
 killclient(Arg *arg) {
 	if(!sel)
 		return;
@@ -266,12 +234,6 @@ manage(Window w, XWindowAttributes *wa) {
 	lt->arrange();
 }
 
-Client *
-nexttiled(Client *c) {
-	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
-	return c;
-}
-
 void
 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
 	float actual, dx, dy, max, min;
@@ -341,6 +303,14 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
 }
 
 void
+toggleversatile(Arg *arg) {
+	if(!sel || lt->arrange == versatile)
+		return;
+	sel->isversatile = !sel->isversatile;
+	lt->arrange();
+}
+
+void
 updatesizehints(Client *c) {
 	long msize;
 	XSizeHints size;
diff --git a/dwm.h b/dwm.h
index 2ae48fa..2751c9e 100644
--- a/dwm.h
+++ b/dwm.h
@@ -105,13 +105,11 @@ extern Window root, barwin;
 /* client.c */
 extern void configure(Client *c);		/* send synthetic configure event */
 extern void focus(Client *c);			/* focus c, c may be NULL */
-extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
-extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
 extern void killclient(Arg *arg);		/* kill c nicely */
 extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
-extern Client *nexttiled(Client *c);		/* returns tiled successor of c */
 extern void resize(Client *c, int x, int y,
 		int w, int h, Bool sizehints);	/* resize with given coordinates c*/
+extern void toggleversatile(Arg *arg);		/* toggles focused client between versatile/and non-versatile state */
 extern void updatesizehints(Client *c);		/* update the size hint variables of c */
 extern void updatetitle(Client *c);		/* update the name of c */
 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*/
 extern void grabkeys(void);			/* grab all keys defined in config.h */
 
 /* layout.c */
+extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
+extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
 extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
 extern void initlayouts(void);			/* initialize layout array */
+extern Client *nexttiled(Client *c);		/* returns tiled successor of c */
 extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
 extern void restack(void);			/* restores z layers of all clients */
 extern void setlayout(Arg *arg);		/* sets layout, -1 toggles */
-extern void toggleversatile(Arg *arg);		/* toggles focusesd client between versatile/and non-versatile state */
 extern void versatile(void);			/* arranges all windows versatile */
 
 /* main.c */
diff --git a/layout.c b/layout.c
index d754afb..e5f635c 100644
--- a/layout.c
+++ b/layout.c
@@ -69,6 +69,38 @@ LAYOUTS
 /* extern */
 
 void
+focusnext(Arg *arg) {
+	Client *c;
+   
+	if(!sel)
+		return;
+	for(c = sel->next; c && !isvisible(c); c = c->next);
+	if(!c)
+		for(c = clients; c && !isvisible(c); c = c->next);
+	if(c) {
+		focus(c);
+		restack();
+	}
+}
+
+void
+focusprev(Arg *arg) {
+	Client *c;
+
+	if(!sel)
+		return;
+	for(c = sel->prev; c && !isvisible(c); c = c->prev);
+	if(!c) {
+		for(c = clients; c && c->next; c = c->next);
+		for(; c && !isvisible(c); c = c->prev);
+	}
+	if(c) {
+		focus(c);
+		restack();
+	}
+}
+
+void
 incnmaster(Arg *arg) {
 	if((lt->arrange != tile) || (nmaster + arg->i < 1)
 	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
@@ -93,6 +125,12 @@ initlayouts(void) {
 	}
 }
 
+Client *
+nexttiled(Client *c) {
+	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
+	return c;
+}
+
 void
 resizemaster(Arg *arg) {
 	if(lt->arrange != tile)
@@ -154,14 +192,6 @@ setlayout(Arg *arg) {
 }
 
 void
-toggleversatile(Arg *arg) {
-	if(!sel || lt->arrange == versatile)
-		return;
-	sel->isversatile = !sel->isversatile;
-	lt->arrange();
-}
-
-void
 versatile(void) {
 	Client *c;
 
='n427' href='#n427'>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 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745