Binary files ../o/keynav-20070705/keynav and keynav/keynav differ
diff -Nurdp ../o/keynav-20070705/keynav.c keynav/keynav.c
--- ../o/keynav-20070705/keynav.c	2007-07-05 22:50:31.000000000 -0700
+++ keynav/keynav.c	2007-08-14 14:10:53.000000000 -0700
@@ -39,10 +39,17 @@ struct wininfo {
 } wininfo;
 
 void defaults();
+//grid navigation
+void cmd_cut_top_left(char *args);
+void cmd_cut_top_right(char *args);
+void cmd_cut_bottom_left(char *args);
+void cmd_cut_bottom_right(char *args);
+//normal navigation
 void cmd_cut_up(char *args);
 void cmd_cut_down(char *args);
 void cmd_cut_left(char *args);
 void cmd_cut_right(char *args);
+//movement
 void cmd_move_up(char *args);
 void cmd_move_down(char *args);
 void cmd_move_left(char *args);
@@ -55,7 +62,9 @@ void cmd_start(char *args);
 void cmd_end(char *args);
 void cmd_quit(char *args); /* XXX: Is this even necessary? */
 
-void update();
+void update(int edge_detection_method);
+#define NORMAL_EDGE 0
+#define HALF_EDGE 1
 void handle_keypress(XKeyEvent *e);
 void handle_commands(char *commands);
 void parse_config();
@@ -65,6 +74,10 @@ struct dispatch {
   char *command;
   void (*func)(char *args);
 } dispatch[] = {
+  "cut-top-left", cmd_cut_top_left,
+  "cut-top-right", cmd_cut_top_right,
+  "cut-bottom-left", cmd_cut_bottom_left,
+  "cut-bottom-right", cmd_cut_bottom_right,
   "cut-up", cmd_cut_up,
   "cut-down", cmd_cut_down,
   "cut-left", cmd_cut_left,
@@ -405,11 +418,48 @@ void cmd_quit(char *args) {
   exit(0);
 }
 
+void cmd_cut_bottom_left(char *args) {
+  if (appstate & STATE_ACTIVE == 0)
+    return;
+  wininfo.h /= 2;
+  wininfo.w /= 2;
+  wininfo.y += wininfo.h;
+  update(HALF_EDGE);
+}
+
+void cmd_cut_bottom_right(char *args) {
+  if (appstate & STATE_ACTIVE == 0)
+    return;
+  wininfo.h /= 2;
+  wininfo.w /= 2;
+  wininfo.y += wininfo.h;
+  wininfo.x += wininfo.w;
+  update(HALF_EDGE);
+}
+
+void cmd_cut_top_left(char *args) {
+  if (appstate & STATE_ACTIVE == 0)
+    return;
+  wininfo.h /= 2;
+  wininfo.w /= 2;
+  update(HALF_EDGE);
+}
+
+void cmd_cut_top_right(char *args) {
+  if (appstate & STATE_ACTIVE == 0)
+    return;
+  wininfo.h /= 2;
+  wininfo.w /= 2;
+  wininfo.x += wininfo.w;
+  update(HALF_EDGE);
+}
+
+
 void cmd_cut_up(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
   wininfo.h /= 2;
-  update();
+  update(NORMAL_EDGE );
 }
 
 void cmd_cut_down(char *args) {
@@ -417,14 +467,14 @@ void cmd_cut_down(char *args) {
     return;
   wininfo.h /= 2;
   wininfo.y += wininfo.h;
-  update();
+  update(NORMAL_EDGE );
 }
 
 void cmd_cut_left(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
   wininfo.w /= 2;
-  update();
+  update(NORMAL_EDGE );
 }
 
 void cmd_cut_right(char *args) {
@@ -432,35 +482,39 @@ void cmd_cut_right(char *args) {
     return;
   wininfo.w /= 2;
   wininfo.x += wininfo.w;
-  update();
+  update(NORMAL_EDGE );
 }
 
 void cmd_move_up(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
-  wininfo.y -= wininfo.h;
-  update();
+  char half = !strncmp(args,"half",5);
+  wininfo.y -= (half)?(wininfo.h/2):(wininfo.h);
+  update(half?HALF_EDGE:NORMAL_EDGE );
 }
 
 void cmd_move_down(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
-  wininfo.y += wininfo.h;
-  update();
+  char half = !strncmp(args,"half",5);
+  wininfo.y += (half)?(wininfo.h/2):(wininfo.h);
+  update(half?HALF_EDGE:NORMAL_EDGE );
 }
 
 void cmd_move_left(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
-  wininfo.x -= wininfo.w;
-  update();
+  char half = !strncmp(args,"half",5);
+  wininfo.x -= half?(wininfo.w/2):(wininfo.w);
+  update(half?HALF_EDGE:NORMAL_EDGE );
 }
 
 void cmd_move_right(char *args) {
   if (appstate & STATE_ACTIVE == 0)
     return;
-  wininfo.x += wininfo.w;
-  update();
+  char half = !strncmp(args,"half",5);
+  wininfo.x += half?(wininfo.w/2):(wininfo.w);
+  update(half?HALF_EDGE:NORMAL_EDGE );
 }
 
 void cmd_warp(char *args) {
@@ -514,16 +568,27 @@ void cmd_drag(char *args) {
 }
 
 
-void update() {
+void update(int edge_detection_method) {
+  switch (edge_detection_method){ 
+  case 0:
   if (wininfo.x < 0)
-    wininfo.x = 0;
+  wininfo.x = 0;
   if (wininfo.x + wininfo.w > rootattr.width)
-    wininfo.x = rootattr.width - wininfo.w;
+  wininfo.x = rootattr.width - wininfo.w;
   if (wininfo.y < 0)
-    wininfo.y = 0;
+  wininfo.y = 0;
   if (wininfo.y + wininfo.h > rootattr.height)
-    wininfo.y = rootattr.height - wininfo.h;
-
+  wininfo.y = rootattr.height - wininfo.h;
+  case 1:
+  if (wininfo.x < -(wininfo.w/2))
+    wininfo.x = -(wininfo.w/2);
+  if (wininfo.x + (wininfo.w /2) > rootattr.width)
+    wininfo.x = rootattr.width - (wininfo.w/2);
+  if (wininfo.y < -(wininfo.h/2))
+    wininfo.y = -(wininfo.h/2);
+  if (wininfo.y + (wininfo.h/2) > rootattr.height)
+    wininfo.y = rootattr.height - (wininfo.h/2);
+  }
   if (wininfo.w <= 1 || wininfo.h <= 1) {
     cmd_end(NULL);
     return;
Binary files ../o/keynav-20070705/.keynav.c.swp and keynav/.keynav.c.swp differ
Binary files ../o/keynav-20070705/keynav.o and keynav/keynav.o differ
Binary files ../o/keynav-20070705/xdo.o and keynav/xdo.o differ
Binary files ../o/keynav-20070705/xdotool/xdo.o and keynav/xdotool/xdo.o differ
