foo-wm

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

commit 82fef2ead1a125a89c606369049b74bf1cae7e87
parent 899f3f6698d0abede49f8da4438518c7a9af07d1
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Mon, 16 Jul 2012 14:58:36 -0400

Directional focus enum

Diffstat:
Msrc/commands.c | 24+++++++++++++-----------
Msrc/structs.h | 1+
2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -36,18 +36,20 @@ void handleCommand(char* request) { dumpTree(); } else if (!strcmp(tokens[0], "layout")) { fprintf(stderr, "Setting layout to: %s", tokens[1]); + + Node *setNode = selectedNode ? selectedNode : focusedNode -> parent; if (!strcmp(tokens[1], "vertical")) - focusedNode -> parent -> layout = VERTICAL; + setNode -> layout = VERTICAL; else if (!strcmp(tokens[1], "horizontal")) - focusedNode -> parent -> layout = HORIZONTAL; + setNode -> layout = HORIZONTAL; else if (!strcmp(tokens[1], "grid")) - focusedNode -> parent -> layout = GRID; + setNode -> layout = GRID; else if (!strcmp(tokens[1], "max")) - focusedNode -> parent -> layout = MAX; + setNode -> layout = MAX; - placeNode(focusedNode -> parent, - (focusedNode -> parent) -> x, (focusedNode -> parent) -> y, - (focusedNode -> parent) -> width, (focusedNode -> parent) -> height); + placeNode(setNode, + setNode -> x, setNode -> y, + setNode -> width, setNode -> height); } else if (!strcmp(tokens[0], "focus")) { if (!strcmp(tokens[1], "cycle")) { @@ -55,10 +57,10 @@ void handleCommand(char* request) { else if (!strcmp(tokens[2], "next")) cycleFocus(NEXT); } else if (!strcmp(tokens[1], "direction")) { - if (!strcmp(tokens[2], "left")) directionFocus(0); - else if (!strcmp(tokens[2], "up")) directionFocus(1); - else if (!strcmp(tokens[2], "right")) directionFocus(2); - else if (!strcmp(tokens[2], "down")) directionFocus(3); + if (!strcmp(tokens[2], "left")) directionFocus(LEFT); + else if (!strcmp(tokens[2], "up")) directionFocus(UP); + else if (!strcmp(tokens[2], "right")) directionFocus(RIGHT); + else if (!strcmp(tokens[2], "down")) directionFocus(DOWN); } } else if (!strcmp(tokens[0], "select")) { diff --git a/src/structs.h b/src/structs.h @@ -1,5 +1,6 @@ #include <X11/Xlib.h> +enum { LEFT, UP, RIGHT, DOWN }; enum { VERTICAL, HORIZONTAL, GRID, MAX }; enum { PREVIOUS, NEXT };