foo-wm

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

commit 373df8953c980232341b38a6db625bdb372194e7
parent bca161cf9dc17bc15a52b624ffbfb1e064845831
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Sun,  8 Jul 2012 13:55:48 -0400

Functioning MapRequest if focusedNode == viewNode
Launch windows when already in fullscreen

Diffstat:
Msrc/config.h | 2+-
Msrc/events.c | 28+++++++++++++++++++---------
Msrc/fifo-wm.c | 2++
Msrc/fifo-wm.h | 5+++--
Msrc/tree.c | 9+++------
5 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/config.h b/src/config.h @@ -8,7 +8,7 @@ // Containers #define CONTAINER_DEFAULT_LAYOUT (2) #define CONTAINER_PADDING (3) -#define BORDER_WIDTH (2) +#define BORDER_WIDTH (1) #define SCREEN_PADDING_TOP (20) #define SCREEN_PADDING_LEFT (2) diff --git a/src/events.c b/src/events.c @@ -7,6 +7,7 @@ #include "fifo-wm.h" #include "events.h" #include "tree.h" +#include "commands.h" #include "window.h" #include "lookup.h" #include "util.h" @@ -28,15 +29,24 @@ void eMapRequest(XEvent *event) { } else if (focusedNode != NULL) { fprintf(stderr,"Mapping based on focusedNode\n"); - - //Brother new node to current focus then focus new node - brotherNode(newNode, focusedNode, 1); - //Rerender parent of (old focus & new node) - placeNode( focusedNode -> parent, - focusedNode -> parent -> x, - focusedNode -> parent -> y, - focusedNode -> parent -> width, - focusedNode -> parent -> height); + if (focusedNode == viewNode && isClient(viewNode)) { + fprintf(stderr, "Just viewing a single client"); + containerize(); + viewNode = focusedNode -> parent; + parentNode(newNode, viewNode); + placeNode(viewNode, + rootX, rootY, + rootWidth, rootHeight); + } else { + //Brother new node to current focus then focus new node + brotherNode(newNode, focusedNode, 1); + //Rerender parent of (old focus & new node) + placeNode( focusedNode -> parent, + focusedNode -> parent -> x, + focusedNode -> parent -> y, + focusedNode -> parent -> width, + focusedNode -> parent -> height); + } } else { //All we have to map on is the view node diff --git a/src/fifo-wm.c b/src/fifo-wm.c @@ -89,6 +89,8 @@ int main() { viewNode -> layout = layout; viewNode -> x = rootX; viewNode -> y = rootY; viewNode -> width = rootWidth; viewNode -> height = rootHeight; + + rootNode = viewNode; XSetErrorHandler((XErrorHandler)(xError)); XFlush(display); diff --git a/src/fifo-wm.h b/src/fifo-wm.h @@ -11,8 +11,9 @@ Window root; /* focusedNode :: Currently focused client node (recieves input) * selectedNode :: Currently selected node (for containerize, move, etc....) - * viewNode :: Currently viewed node (screenspace) */ -Node *focusedNode, *selectedNode, *viewNode; + * viewNode :: Currently viewed node (screenspace) + * rootNode :: Node at the top of the tree*/ +Node *focusedNode, *selectedNode, *viewNode, *rootNode; /* X Window -> Node Lookup Table */ Lookup * lookup; diff --git a/src/tree.c b/src/tree.c @@ -42,7 +42,7 @@ void crawlNode(Node * node, int level) { void dumpTree() { fprintf(stderr, "Printing the tree\n"); fprintf(stderr, "----------------------------------\n"); - crawlNode(viewNode, 0); + crawlNode(rootNode, 0); fprintf(stderr, "----------------------------------\n"); } @@ -87,6 +87,8 @@ void destroyNode(Node * n) { if (n == NULL) return; if (n -> parent == NULL) return; + //Asking to destroy a node who once disowned would leave an empty node + //Recall destroyNode on parent if ( n -> next == NULL && n -> parent -> child == n && n -> previous == NULL && n -> parent -> parent != NULL) { fprintf(stderr, "Calling destroy node on parent\n"); @@ -97,8 +99,6 @@ void destroyNode(Node * n) { //Unparent the node unparentNode(n); - fprintf(stderr, "Sucessfull destroy node\n"); - dumpTree(); //Recursivly unmap all children of the node if (isClient(n)) { removeLookupEntry(&n -> window); @@ -114,9 +114,6 @@ void destroyNode(Node * n) { } - fprintf(stderr, "POST DESTROY\n"); - dumpTree(); - if (n == focusedNode) focusedNode = NULL; free(n); }