foo-wm

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

commit df89fe56f98dffea68b6352ae5d68585f3e94d7e
parent 5b245ca2c8a54cab1d5ed55ea579a53ba520dbdb
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Mon,  2 Jul 2012 23:44:12 -0400

Using getClosestNode for better destroyNode

Diffstat:
Msrc/events.c | 2+-
Msrc/tree.c | 29++++++-----------------------
Msrc/tree.h | 2++
3 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/src/events.c b/src/events.c @@ -54,7 +54,7 @@ void eDestroyNotify(XEvent *event) { if (n == NULL) { return; } fprintf(stderr," Getting cloest node to %p\n", n); - activeNode = getClosestNode(n); + //activeNode = getClosestNode(n); fprintf(stderr, "Got the cloest node, is: %p\n", activeNode); destroyNode(n); diff --git a/src/tree.c b/src/tree.c @@ -71,12 +71,12 @@ void destroyNode(Node * n) { XUnmapWindow(display, n -> window); } else { fprintf(stderr, "The child is %p\n", n -> child); - Node * child; - /* - for (child = n -> child; child != NULL; child = child -> next) { - destroyNode(child); + if (n -> child -> next != NULL) { + Node * child; + for (child = n -> child; child != NULL; child = child -> next) { + destroyNode(child); + } } - */ } free(n); @@ -88,24 +88,7 @@ void unparentNode(Node *node) { if (node == NULL || node -> parent == NULL) { return; } fprintf(stderr, "unparent called"); - - if (node == activeNode) { - if (isClient(node -> next)) { - activeNode = node -> next; - } else if (isClient(node -> previous)) { - activeNode = node -> previous; - } else { - Node * n = (node -> parent) -> child; - while (isClient(n) == False || n == node) { - n = n -> next; - } - activeNode = n; - } - - } - //activeNode = lookup -> node; - - fprintf(stderr, "GOT HERE"); + activeNode = getClosestNode(node); if ((node -> parent) -> child == node) { (node -> parent) -> child = node -> next; diff --git a/src/tree.h b/src/tree.h @@ -7,4 +7,6 @@ void focusNode(Node * node); void unmapNode(Node * node); void placeNode(Node * node, int x, int y, int width, int height); Node * getNodeByWindow(Window * window); +Node * getClosestNode(Node * node); + Bool isClient(Node * n);