foo-wm

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

commit 92cd99d9a035508ae5c7c66e5cd01651d669a2eb
parent 0d268c4a4649c92d3700558f86dfc67e0b85c74f
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Mon, 16 Jul 2012 18:11:13 -0400

Setting the view within focusNode()

Diffstat:
Msrc/commands.c | 15+++++----------
Msrc/tree.c | 6++++++
2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -129,11 +129,11 @@ void cycleFocus(int direction) { if (direction == PREVIOUS) { if (!(newFocus = focusOrigin -> previous)) { newFocus = focusOrigin; - while (newFocus -> next != NULL) + while (newFocus -> next) newFocus = newFocus -> next; } } else { - if (!(newFocus = focusOrigin -> next)) { + if (!(newFocus = focusOrigin -> next) && focusOrigin -> parent) { newFocus = focusOrigin -> parent -> child; } } @@ -213,14 +213,9 @@ void kill() { if (focusedNode == viewNode) viewNode = viewNode -> parent; if ( !focusedNode -> next && !focusedNode -> previous - && viewNode == focusedNode -> parent) { - if (focusedNode -> parent -> parent != NULL) { - fprintf(stderr, "Parent's parent exists\n"); - viewNode = focusedNode -> parent -> parent; - } else { - fprintf(stderr, "Parent's parent does not exist\n"); - viewNode = focusedNode -> parent; - } + && focusedNode -> parent) { + viewNode = focusedNode -> parent -> parent ? + focusedNode -> parent -> parent : focusedNode -> parent; } destroyNode(focusedNode); diff --git a/src/tree.c b/src/tree.c @@ -64,9 +64,15 @@ void focusNode(Node * n, XEvent * event) { GrabModeAsync, GrabModeAsync, None, None); } + Bool setView = (focusedNode == viewNode) ? True : False; + //Set the Focused Node and + if (selectedNode) + placeNode(selectedNode, selectedNode -> x, selectedNode -> y, + selectedNode -> width, selectedNode -> height); selectedNode = NULL; focusedNode = n; + if (setView) viewNode = focusedNode; if (focusedNode -> parent != NULL) { focusedNode -> parent -> focus = focusedNode; if (focusedNode -> parent -> layout == MAX)