Index: generic/tkGrab.c
==================================================================
--- generic/tkGrab.c
+++ generic/tkGrab.c
@@ -713,10 +713,11 @@
     case TK_GRAB_EXCLUDED:
 	appGrabbed = 1;
 	outsideGrabTree = 1;
 	break;
     }
+printf("\nTkPointerEvent ENTERED\n  eventPtr->type is %d\n", eventPtr->type);
 
     if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
 	/*
 	 * Keep track of what window the mouse is *really* over. Any events
 	 * that we generate have a special send_event value, which is detected
@@ -723,17 +724,21 @@
 	 * below and used to ignore the event for purposes of setting
 	 * serverWinPtr.
 	 */
 
 	if (eventPtr->xcrossing.send_event != GENERATED_GRAB_EVENT_MAGIC) {
-	    if ((eventPtr->type == LeaveNotify) &&
+            if ((eventPtr->type == LeaveNotify) &&
 		    (winPtr->flags & TK_TOP_HIERARCHY)) {
+printf("  LeaveNotify & TK_TOP_HIERARCHY, not a GENERATED_GRAB_EVENT_MAGIC, dispPtr->serverWinPtr set to NULL\n");
 		dispPtr->serverWinPtr = NULL;
 	    } else {
+printf("  EnterNotify, not a GENERATED_GRAB_EVENT_MAGIC, dispPtr->serverWinPtr set to winPtr = %p\n", winPtr);
 		dispPtr->serverWinPtr = winPtr;
 	    }
-	}
+        } else {
+printf("  EnterNotify || LeaveNotify, this is a GENERATED_GRAB_EVENT_MAGIC\n");
+        }
 
 	/*
 	 * When a grab is active, X continues to report enter and leave events
 	 * for windows outside the tree of the grab window:
 	 * 1. Detect these events and ignore them except for windows above the
@@ -773,10 +778,11 @@
 	}
 	return 1;
     }
 
     if (!appGrabbed) {
+printf("TkPointerEvent LEFT, eventPtr->type is %d, !appGrabbed\n", eventPtr->type);
 	return 1;
     }
 
     if (eventPtr->type == MotionNotify) {
 	/*
@@ -794,14 +800,16 @@
 	    winPtr2 = dispPtr->buttonWinPtr;
 	} else if (outsideGrabTree || (dispPtr->serverWinPtr == NULL)) {
 	    winPtr2 = dispPtr->grabWinPtr;
 	}
 	if (winPtr2 != winPtr) {
+printf("  MotionNotify, TkChangeEventWindow is called with winPtr2 = %p\n", winPtr2);
 	    TkChangeEventWindow(eventPtr, winPtr2);
 	    Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
 	    return 0;
 	}
+printf("  MotionNotify, TkChangeEventWindow is NOT called\n");
 	return 1;
     }
 
     /*
      * Process ButtonPress and ButtonRelease events:
@@ -830,12 +838,12 @@
      *    This causes enter and leave events no longer to be generated in the
      *    same way as for global grabs. To eliminate this problem, set a
      *    temporary global grab when the first button goes down and release it
      *    when the last button comes up.
      */
-
     if ((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease)) {
+printf("  ButtonPress || ButtonRelease\n");
 	winPtr2 = dispPtr->buttonWinPtr;
 	if (winPtr2 == NULL) {
 	    if (outsideGrabTree) {
 		winPtr2 = dispPtr->grabWinPtr;			/* Note 5. */
 	    } else {
@@ -880,10 +888,11 @@
 	    TkChangeEventWindow(eventPtr, winPtr2);
 	    Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
 	    return 0;						/* Note 3. */
 	}
     }
+printf("TkPointerEvent LEFT, eventPtr->type is %d\n", eventPtr->type);
 
     return 1;
 }
 
 /*

