foo-wm

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

commit 77e99605810e43ff68dd9d0745ef570f851efbba
parent 6b5b904c3354697040c36251927195818c90bf63
Author: = <miles.sandlar@gmail.com>
Date:   Fri, 27 Jul 2012 22:41:49 -0400

Refocusing when zooming in

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

diff --git a/src/commands.c b/src/commands.c @@ -72,7 +72,8 @@ void move(int amount) { /* Updates the viewNode approximating the current focusNode */ void zoom(int level) { while (level < 0) { - if (viewNode -> parent) { unmapNode(viewNode); + if (viewNode -> parent) { + unmapNode(viewNode); viewNode = viewNode -> parent; placeNode(viewNode, rootX, rootY, rootWidth, rootHeight); focusNode(focusedNode, NULL, True); @@ -82,15 +83,16 @@ void zoom(int level) { level++; } while (level > 0) { - if (focusedNode != viewNode) { - Node *n = focusedNode; - while (n && n -> parent != viewNode) n = n -> parent; - if (!n) return; - - unmapNode(viewNode); - viewNode = n; - placeNode(viewNode, rootX, rootY, rootWidth, rootHeight); - } else { return; } + if (focusedNode == viewNode) return; + Node *n = focusedNode; + while (n && n -> parent != viewNode) n = n -> parent; + if (!n) return; + + unmapNode(viewNode); + viewNode = n; + if (viewNode == focusedNode) focusNode( focusedNode -> focus ? + focusedNode -> focus : focusedNode -> child, NULL, True); + placeNode(viewNode, rootX, rootY, rootWidth, rootHeight); level--; } }