From 23de91e5b419d360b77cbf677f8379cc8e0ef25b Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 21 Oct 2008 21:00:52 +0200 Subject: [PATCH] client: Remove client_switch function: put all in uicb_client_{prev, next} --- src/client.c | 60 ++++++++++++++++++++++------------------------------ src/tag.c | 1 - src/wmfs.h | 1 - 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/src/client.c b/src/client.c index 6d0a1d9..9c0c55f 100644 --- a/src/client.c +++ b/src/client.c @@ -66,59 +66,49 @@ client_detach(Client *c) return; } -/* True : next - * False : prev */ void -client_switch(Bool b) +uicb_client_prev(uicb_t cmd) { Client *c; if(!sel || ishide(sel)) return; - if(b) + + for(c = sel->prev; c && ishide(c); c = c->prev); + if(!c) { - for(c = sel->next; c && ishide(c); c = c->next); - if(!c) - for(c = clients; c && ishide(c); c = c->next); - if(c) - { - client_focus(c); - if(!c->tile) - client_raise(c); - } + for(c = clients; c && c->next; c = c->next); + for(; c && ishide(c); c = c->prev); } - else + if(c) { - for(c = sel->prev; c && ishide(c); c = c->prev); - if(!c) - { - for(c = clients; c && c->next; c = c->next); - for(; c && ishide(c); c = c->prev); - } - if(c) - { - client_focus(c); - if(!c->tile) - client_raise(c); - } + client_focus(c); + if(!c->tile) + client_raise(c); } arrange(); return; } -void -uicb_client_prev(uicb_t cmd) -{ - client_switch(False); - - return; -} - void uicb_client_next(uicb_t cmd) { - client_switch(True); + Client *c; + + if(!sel || ishide(sel)) + return; + + for(c = sel->next; c && ishide(c); c = c->next); + if(!c) + for(c = clients; c && ishide(c); c = c->next); + if(c) + { + client_focus(c); + if(!c->tile) + client_raise(c); + } + arrange(); return; } diff --git a/src/tag.c b/src/tag.c index 7ed75e6..6020174 100644 --- a/src/tag.c +++ b/src/tag.c @@ -32,7 +32,6 @@ #include "wmfs.h" - /* if cmd is +X or -X, this is just switch * else {1, 2.. 9} it's go to the wanted tag. */ void diff --git a/src/wmfs.h b/src/wmfs.h index 8ca6b51..997facc 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -84,7 +84,6 @@ ushort textw(const char *text); int client_pertag(int tag); void client_attach(Client *c); void client_detach(Client *c); -void client_switch(Bool c); void client_focus(Client *c); Client *client_get(Window w); Client *client_gettbar(Window w);