Index: /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/EventLoop.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/EventLoop.c	(revision 36749)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/EventLoop.c	(revision 36750)
@@ -1,3 +1,4 @@
 # include "Ximage.h"
+# define DEBUG 0
 
 /* list events being selected below, all other masks are ignored */ 
@@ -6,9 +7,27 @@
 int LastEvent (Display *display, int type, XEvent *event) {
 
-  int found;
+  int found, Nfound;
 
   found = FALSE;
+  Nfound = 0;
   while (XCheckTypedEvent (display, type, event)) {
+    // If the link is slow, then I should wait a little while for some config events to
+    // build up (typically, the window is being dragged around, so we get a whole series of 
+    // config events.  the flush / sync time is slow on a slow link, so we should try to wait
+    // for the config events to stop, but on a timescale deteremined by the flush/sync time
+    // if (type == ConfigureNotify) fprintf (stderr, "config (%d)\n", Nfound);
+    Nfound ++;
     found = TRUE;
+  }
+  if (DEBUG && found) {
+    if (type == ConfigureNotify) fprintf (stderr, "config (%d)\n", Nfound);
+    if (type == CirculateNotify) fprintf (stderr, "circul (%d)\n", Nfound);
+    if (type == Expose) fprintf (stderr, "expose (%d)\n", Nfound);
+  }
+
+  // if I have a ConfigureNotify event, I should purge all Expose events as well:
+  if (found && (type == ConfigureNotify)) {
+    XEvent discard;
+    while (XCheckTypedEvent (display, Expose, &discard));
   }
   return (found);
@@ -38,13 +57,14 @@
 
     if (XEventsQueued (display, QueuedAfterFlush) < 1) {
-      /* fprintf (stderr, "."); */
       usleep (50000);
       continue;
     }
 
+    // If I have a config event, I want to also purge all expose events
+
     /* grab the last entry for these events */
-    if (LastEvent (display, ConfigureNotify, &event)) Reconfig (&event);
-    if (LastEvent (display, CirculateNotify, &event)) Reconfig (&event);
-    if (LastEvent (display, Expose,          &event)) Refresh ();
+    if (LastEvent (display, ConfigureNotify, &event)) { Reconfig (&event); continue; }
+    if (LastEvent (display, CirculateNotify, &event)) { Reconfig (&event); continue; }
+    if (LastEvent (display, Expose,          &event)) { Refresh (); continue; }
     if (LastEvent (display, MappingNotify,   &event)) XRefreshKeyboardMapping ((XMappingEvent *) &event);
     if (LastEvent (display, MotionNotify,    &event)) UpdatePointer (graphic, (XMotionEvent *) &event);
Index: /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/FlushDisplay.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/FlushDisplay.c	(revision 36749)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/FlushDisplay.c	(revision 36750)
@@ -30,5 +30,7 @@
 
   if (flush) {
-    XFlush (graphic->display);
+    // I changed XFlush to XSync to avoid lag
+    // of the display (build up of config events)
+    XSync (graphic->display, FALSE);
     reftime = now;
   }
Index: /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/Refresh.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/Refresh.c	(revision 36749)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/kapa2/src/Refresh.c	(revision 36750)
@@ -47,5 +47,4 @@
   Y0 = graphic[0].dy - graphic[0].dy * section[0].y - dY;
   X0 = graphic[0].dx * section[0].x;
-  // fprintf (stderr, "section: (%s) %d %d - %d %d\n", section[0].name, X0, Y0, dX, dY);
 
   XFillRectangle (graphic[0].display,  graphic[0].window, graphic[0].gc, X0, Y0, dX, dY);
Index: /branches/eam_branches/ipp-20140423/Ohana/src/opihi/dvo/coordmosaic.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/opihi/dvo/coordmosaic.c	(revision 36749)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/opihi/dvo/coordmosaic.c	(revision 36750)
@@ -174,11 +174,11 @@
 	double fx = ix * dX - 0.5*NX; // coordinate in full image
 
-	double Lo, Lm, dL;
-	double Mo, Mm, dM;
+	double Lo, Lm; //, dL;
+	double Mo, Mm; //, dM;
 
 	XY_to_LM (&Lo, &Mo, fx, fy, &coords);
 	XY_to_LM (&Lm, &Mm, fx, fy, &linear);
-	dL = Lo - Lm;
-	dM = Mo - Mm;
+	// dL = Lo - Lm;
+	// dM = Mo - Mm;
 
 	// vX[ix + iy*Nx] += dL;
