foo-wm

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

commit 130282c52a7038c3c46300dea70749fbbc166eea
parent 0f5c66c1a5dfba2b56751d19ff3a2b80fe9cda73
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Tue,  3 Jul 2012 18:10:38 -0400

Minor Bugfixes

Diffstat:
Msrc/commands.c | 13++++++++-----
Msrc/events.c | 10++--------
Msrc/fifo-wm.c | 7++-----
Msrc/tree.c | 7++++---
4 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -114,13 +114,16 @@ void handleCommand(char* request) { dumpTree(); fprintf(stderr, "Destroy Client %p\n", activeNode); - destroyNode(activeNode); + if (isClient(activeNode)) { + destroyNode(activeNode); - dumpTree(); - placeNode(viewNode, - viewNode -> x, viewNode -> y, - viewNode -> width, viewNode -> height); + dumpTree(); + + placeNode(viewNode, + viewNode -> x, viewNode -> y, + viewNode -> width, viewNode -> height); + } } else if (!strcmp(tokens[1], "container")) { dumpTree(); fprintf(stderr, "Destroy Container %p\n", activeNode -> parent); diff --git a/src/events.c b/src/events.c @@ -16,7 +16,7 @@ void eMapRequest(XEvent *event) { Node *newNode = allocateNode(); newNode -> window = event -> xmaprequest.window; - if (activeNode == NULL) { + if (activeNode == NULL || !isClient(activeNode)) { parentNode(newNode, viewNode); } else { parentNode(newNode, activeNode -> parent); @@ -53,14 +53,8 @@ void eDestroyNotify(XEvent *event) { Node *n = getNodeByWindow(&(event -> xdestroywindow.window)); if (n == NULL) { return; } - fprintf(stderr," Getting cloest node to %p\n", n); - //activeNode = getClosestNode(n); - fprintf(stderr, "Got the cloest node, is: %p\n", activeNode); - + activeNode = getClosestNode(n); destroyNode(n); - fprintf(stderr, "Passed the destroyu node\n"); - fprintf(stderr, "Yo my viewnode is %p", viewNode); - //Update view placeNode( viewNode, rootX, rootY, rootWidth, rootHeight); diff --git a/src/fifo-wm.c b/src/fifo-wm.c @@ -83,13 +83,10 @@ int main() { KeyPressMask | ButtonPressMask ); - viewNode = malloc(sizeof(Node)); + viewNode = allocateNode(); viewNode -> layout = layout; viewNode -> x = rootX; viewNode -> y = rootY; - viewNode -> width = rootWidth; - viewNode -> height = rootHeight; - viewNode -> previous = NULL; viewNode -> next = NULL; - viewNode -> parent = NULL; viewNode -> child = NULL; + viewNode -> width = rootWidth; viewNode -> height = rootHeight; XSetErrorHandler((XErrorHandler)(xError)); XFlush(display); diff --git a/src/tree.c b/src/tree.c @@ -55,9 +55,9 @@ void destroyNode(Node * n) { if (n == NULL) { return; } if ( (n -> next == NULL && - (n -> parent -> child == n && n -> previous == NULL)) && + (n -> parent -> child == n && n -> previous == NULL)) && n -> parent -> parent != NULL - ) { + ) { fprintf(stderr, "Calling destroy node on parent\n"); destroyNode(n -> parent); return; @@ -183,6 +183,7 @@ void placeNode(Node * node, int x, int y, int width, int height) { } } + Bool isClient(Node * node) { if (node == NULL) { return False; } if (node -> window != (Window) NULL) { return True; @@ -213,7 +214,7 @@ Node * getClosestNode(Node * node) { } //If not returned by here must look for more nodes in the parent, recur if (node -> parent == NULL) { return NULL; } else { - fprintf(stderr,"Calling get on %p\n", node -> parent); + fprintf(stderr,"Calling get on %p\n", node -> parent); Node *j; j = getClosestNode(node -> parent); if (j != node) { return j; } else { return NULL; }