Simplifying the lastsel handling a bit. - tabbed - tab interface for applicatio… | |
git clone git://git.suckless.org/tabbed | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 030eda81cc622ad0c3efe2ab1f1a657ee82e45cb | |
parent 4ed0a2da67f742cfb75f85fc02f703e21a0206d6 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sun, 26 Jan 2014 20:05:40 +0100 | |
Simplifying the lastsel handling a bit. | |
Some checks and comments were removed to simplify the function. | |
Diffstat: | |
M tabbed.c | 27 +++++++++------------------ | |
1 file changed, 9 insertions(+), 18 deletions(-) | |
--- | |
diff --git a/tabbed.c b/tabbed.c | |
@@ -1059,9 +1059,10 @@ unmanage(int c) { | |
return; | |
} | |
- if(!nclients) { | |
+ if(!nclients) | |
return; | |
- } else if(c == 0) { | |
+ | |
+ if(c == 0) { | |
/* First client. */ | |
nclients--; | |
free(clients[0]); | |
@@ -1080,35 +1081,25 @@ unmanage(int c) { | |
} | |
if(nclients <= 0) { | |
- sel = -1; | |
- lastsel = -1; | |
+ lastsel = sel = -1; | |
- if (closelastclient) { | |
+ if(closelastclient) { | |
running = False; | |
- } else if (fillagain && running) { | |
+ } else if(fillagain && running) { | |
spawn(NULL); | |
} | |
} else { | |
- if(c && lastsel >= nclients) { | |
+ if(lastsel >= nclients) { | |
lastsel = nclients - 1; | |
} else if(lastsel > c) { | |
lastsel--; | |
} | |
if(c == sel) { | |
- /* Note that focus() will never set lastsel == sel, | |
- * so if here lastsel == sel, it was decreased by abov… | |
- * and was actually (sel + 1) before. | |
- */ | |
- if(lastsel > 0) { | |
- focus(lastsel); | |
- } else { | |
- focus(0); | |
- lastsel = 1; | |
- } | |
+ focus(lastsel); | |
} else { | |
if(sel > c) | |
- sel -= 1; | |
+ sel--; | |
if(sel >= nclients) | |
sel = nclients - 1; | |