foo-wm

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

commit 5a1ef3c1f4b0a7ac4ea50c70a44d506241334482
parent 72ee3d81be067d11111f4fdcced1ae9c8ccc6402
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Sun, 15 Jul 2012 15:05:54 -0400

Simplification of getClient()
Substituted out for layout of values for defines

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

diff --git a/src/commands.c b/src/commands.c @@ -37,13 +37,13 @@ void handleCommand(char* request) { } else if (!strcmp(tokens[0], "layout")) { fprintf(stderr, "Setting layout to: %s", tokens[1]); if (!strcmp(tokens[1], "vertical")) - focusedNode -> parent -> layout = 0; + focusedNode -> parent -> layout = VERTICAL; else if (!strcmp(tokens[1], "horizontal")) - focusedNode -> parent -> layout = 1; + focusedNode -> parent -> layout = HORIZONTAL; else if (!strcmp(tokens[1], "grid")) - focusedNode -> parent -> layout = 2; + focusedNode -> parent -> layout = GRID; else if (!strcmp(tokens[1], "max")) - focusedNode -> parent -> layout = 3; + focusedNode -> parent -> layout = MAX; placeNode(focusedNode -> parent, (focusedNode -> parent) -> x, (focusedNode -> parent) -> y, @@ -120,18 +120,11 @@ void handleCommand(char* request) { * Does not loop */ Node * getClient (Node *start, int direction) { Node *n = (direction == 0) ? start -> previous : start -> next; - while (n != NULL) { - if (isClient(n)) return n; + while (n) + if (isClient(n)) return n; + else if (direction == 0) n = n -> previous; + else if (direction == 1) n = n -> next; - if (direction == 0) { - if (n -> previous == NULL) return NULL; - else n = n -> previous; - - } else if (direction == 1) { - if (n -> next == NULL) return NULL; - else n = n -> next; - } - } return n; }