foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit 6af857a8f6cfce64945ae724e9c14e59ff82bdec
parent 3bad82b43f6652c97753deb392a3ebcda625be8e
Author: = <miles.sandlar@gmail.com>
Date:   Fri, 12 Oct 2012 05:19:23 -0400

More concise focus command - use getBrother
getBrother is faster than looping. -- Still neeed similar (getPc)
Accomodate for focus by id

Diffstat:
Msrc/commands.c | 27++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -98,27 +98,24 @@ void containerize(void) { void focus(char * argA, char * argB) { if (!focusedNode) return; - int delta = atoi(argB); - int brotherSwitch = -1; - if (!strcmp(argA, "brother")) brotherSwitch = 1; - else if (!strcmp(argA, "pc")) brotherSwitch = 0; - else return; + int delta = atoi(argB); + Node * newFocus = NULL; - while (delta != 0) { - Node * newFocus = NULL; + if (!strcmp(argA, "id")) { - if (brotherSwitch) { - newFocus = getBrother(focusedNode, (delta < 0) ? -1 : 1); - } else { + } else if (!strcmp(argA, "brother")) { + newFocus = getBrother(focusedNode, delta); + } else if (!strcmp(argA, "pc")) { + while (delta != 0) { newFocus = (delta < 0) ? - focusedNode -> parent : focusOrChildOf(focusedNode); - } - - focusNode(newFocus, NULL, True, True); - delta = delta + ( delta > 0 ? -1 : 1); + focusedNode -> parent : focusOrChildOf(focusedNode); + delta = delta + ( delta > 0 ? -1 : 1); + focusNode(newFocus, NULL, True, True); + } return; } + focusNode(newFocus, NULL, True, True); } char * get(char * property) {