[hackers] [dwm] removed getnext/getprev, redundant

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri Feb 16 14:15:46 2007

changeset: 761:4e835c2a7a12
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Fri Feb 16 10:20:34 2007 +0100
summary: removed getnext/getprev, redundant

diff -r 8ed842c35e8d -r 4e835c2a7a12 dwm.h
--- a/dwm.h Wed Feb 14 14:01:12 2007 +0100
+++ b/dwm.h Fri Feb 16 10:20:34 2007 +0100
@@ -128,8 +128,6 @@ extern int xerror(Display *dsply, XError
 
 /* tag.c */
 extern void initrregs(void); /* initialize regexps of rules defined in config.h */
-extern Client *getnext(Client *c); /* returns next visible client */
-extern Client *getprev(Client *c); /* returns previous visible client */
 extern void settags(Client *c, Client *trans); /* sets tags of c */
 extern void tag(Arg *arg); /* tags c with arg's index */
 extern void toggletag(Arg *arg); /* toggles c tags with arg's index */
diff -r 8ed842c35e8d -r 4e835c2a7a12 tag.c
--- a/tag.c Wed Feb 14 14:01:12 2007 +0100
+++ b/tag.c Fri Feb 16 10:20:34 2007 +0100
@@ -30,18 +30,6 @@ static unsigned int len = 0;
 static unsigned int len = 0;
 
 /* extern */
-
-Client *
-getnext(Client *c) {
- for(; c && !isvisible(c); c = c->next);
- return c;
-}
-
-Client *
-getprev(Client *c) {
- for(; c && !isvisible(c); c = c->prev);
- return c;
-}
 
 void
 initrregs(void) {
diff -r 8ed842c35e8d -r 4e835c2a7a12 view.c
--- a/view.c Wed Feb 14 14:01:12 2007 +0100
+++ b/view.c Fri Feb 16 10:20:34 2007 +0100
@@ -8,7 +8,7 @@
 
 static Client *
 nexttiled(Client *c) {
- for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
+ for(; c && (c->isfloat || !isvisible(c)); c = c->next);
         return c;
 }
 
@@ -125,8 +125,9 @@ focusnext(Arg *arg) {
    
         if(!sel)
                 return;
- if(!(c = getnext(sel->next)))
- c = getnext(clients);
+ 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();
@@ -139,9 +140,10 @@ focusprev(Arg *arg) {
 
         if(!sel)
                 return;
- if(!(c = getprev(sel->prev))) {
+ for(c = sel->prev; c && !isvisible(c); c = c->prev);
+ if(!c) {
                 for(c = clients; c && c->next; c = c->next);
- c = getprev(c);
+ for(; c && !isvisible(c); c = c->prev);
         }
         if(c) {
                 focus(c);
Received on Fri Feb 16 2007 - 14:15:46 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:23 UTC