Index: trunk/Ohana/src/kii/event/CheckPipe.c
===================================================================
--- trunk/Ohana/src/kii/event/CheckPipe.c	(revision 2466)
+++ trunk/Ohana/src/kii/event/CheckPipe.c	(revision 2888)
@@ -1,14 +1,17 @@
 # include "Ximage.h"
 # define STRCONST(A) ((int)(0x1000000*A[0] + 0x10000*A[1] + 0x100*A[2] + 0x1*A[3]))
+# define DEBUG 0
+
+static int ActiveCursor = FALSE;
 
 int CheckPipe (Graphic *graphic, Layout *layout) {
 
   int status;
-  char buffer[1024];
+  char buffer[20];
+
+  bzero (buffer, 20);
 
   /* attempt to read 4 bytes from stdin */
-
   status = read (layout[0].Ximage, buffer, 4);
-  buffer[4] = 0;
 
   switch (status) {
@@ -24,5 +27,5 @@
 
   case 4:
-/*    fprintf (stderr, "got signal %s from pipe\n", buffer);    */
+    if (DEBUG) fprintf (stderr, "got signal %s from pipe\n", buffer);
     break;
 
@@ -32,8 +35,17 @@
     break;
   }
+  
+  /* In Active Cursor mode, we can only receive the NCUR signal */
+  if (ActiveCursor) {
+    if (!strcmp (buffer, "NCUR")) {
+      ActiveCursor = FALSE;
+      return (2);
+    }
+    fprintf (stderr, "unknown signal %s\n", buffer);
+    return (TRUE);
+  }
 
-  
   if (!strcmp (buffer, "QUIT")) {
-    /* fprintf (stderr, "Goodbye!\n"); */
+    if (DEBUG) fprintf (stderr, "Goodbye!\n");
     return (FALSE);
   }
@@ -45,6 +57,12 @@
 
   if (!strcmp (buffer, "CURS")) {
+    ActiveCursor = TRUE;
     status = cursor (graphic, layout);
     return (status);
+  }
+
+  if (!strcmp (buffer, "NCUR")) {
+    fprintf (stderr, "error: not in active cursor mode\n");
+    return (TRUE);
   }
 
