foo-wm

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

commit ebd269c344673863cb76a0c44879c8aba6a4de60
parent 41f457c06b6cd042b5056310c2d61f7364f85dc7
Author: = <miles.sandlar@gmail.com>
Date:   Tue, 23 Oct 2012 13:13:31 -0400

Preliminary implementation of swap IPC command

Diffstat:
Msrc/commands.c | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -41,6 +41,8 @@ char * handleCommand(char * request) { set(tokens[1], tokens[2]); else if (!strcmp(tokens[0], "shift")) shift(tokens[1], atoi(tokens[2])); + else if (!strcmp(tokens[0], "swap")) + swap(tokens[1], tokens[2]); else if (!strcmp(tokens[0], "zoom")) zoom(atoi(tokens[1])); @@ -249,6 +251,20 @@ void shift(char * argA, int delta) { } } } + +} + +/* Swaps two nodes in place based on node ids */ +Bool swap(char * argA , char * argB) { + int idA = atoi(argA), + idB = atoi(argB); + Node *nodeA = getNodeById(idA), + *nodeB = getNodeById(idB); + + if (!nodeA || !nodeB) return False; + + swapNodes(nodeA, nodeB); + return True; }