WinWorkstation.st
changeset 3962 425f5e384a15
parent 3961 e2f3d8b87361
child 3963 df6bc1548520
--- a/WinWorkstation.st	Mon Nov 24 17:22:41 2003 +0100
+++ b/WinWorkstation.st	Tue Nov 25 19:56:17 2003 +0100
@@ -59,9 +59,12 @@
 #define CACHE_LAST_WM_PAINT_DC          /* remember last viewBackground paints dc */
 #define CACHE_LAST_TMP_FONT             /* */
 
+#endif
+
+
 #define CACHE_PEN
 #define CACHE_BRUSH
-#endif
+
 
 #ifdef CACHE_PEN
 # define NUM_PEN_CACHED_W95   8          /* that many solid pens are globally remembered */
@@ -1830,16 +1833,13 @@
     return 1;
 }
 
-#define ENQ_AT_END      0
-#define ENQ_AT_FRONT    1
-
 #define EV_NOTIME       0
 
-#define enqEvent(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
-    __enqEvent(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+#define enqEvent(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
+    __enqEvent(a1, a2, a3, a4, a5, a6, a7, a8, a9)
 
 static void
-__enqEvent(atFront, flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
+__enqEvent(flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
     HWND hWnd;
     UINT message;
     UINT wParam;
@@ -1878,9 +1878,6 @@
 
 	unlockEventFreeList();
 
-#if 0
-	SetEvent(hInputEvent);
-#endif
 	if (repeatCount++ >= 5) {
 	    /* throw away sorry */
 	    fprintf(stderr, "WinWorkstation [info]: event throw away\n");
@@ -1905,24 +1902,15 @@
 
     needSetEvent = (eventQueueHead == NULL);
 
-    if (atFront) {
-	ev->count = -1;
-	ev->ev_next = eventQueueHead;
-	eventQueueHead = ev;
-	if (eventQueueTail == 0) {
-	    eventQueueTail = ev;
-	}
+    ev->count = eventsendcount++;
+    ev->ev_next = (struct queuedEvent *) 0;
+
+    if (eventQueueTail) {
+	eventQueueTail->ev_next = ev;
     } else {
-	ev->count = eventsendcount++;
-
-	ev->ev_next = (struct queuedEvent *)0;
-	if (eventQueueTail) {
-	    eventQueueTail->ev_next = ev;
-	} else {
-	    eventQueueHead = ev;
-	}
-	eventQueueTail = ev;
-    }
+	eventQueueHead = ev;
+    }
+    eventQueueTail = ev;
 
     unlockEventQ();
 
@@ -2304,7 +2292,7 @@
 		     && (i == (numRects - 1))) {
 			final = 1;
 		    }
-		    enqEvent(ENQ_AT_END, ExposureMask, hWnd, msgType, final, 
+		    enqEvent(ExposureMask, hWnd, msgType, final, 
 			     pRect[i].left, pRect[i].top, 
 			     pRect[i].right - pRect[i].left,
 			     pRect[i].bottom - pRect[i].top,
@@ -2628,7 +2616,7 @@
 	case WM_CLOSE:
 	    EVENT_PRINTF(("WM_CLOSE\n"));
 	    if (! destroyWin) {
-		enqEvent(ENQ_AT_END, 0, hWnd, WM_CLOSE, wParam, 0, 0, 0, 0, EV_NOTIME);
+		enqEvent(0, hWnd, WM_CLOSE, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    } else {
 		destroyWin = 0;
 		{
@@ -2683,12 +2671,12 @@
 		SETLOCALWINDOWINFOPTR(hWnd, 0);
 
 #ifdef FREE_LI_IN_STX_PROCESS
-		enqEvent(ENQ_AT_END, 0, hWnd, WM_DESTROY, wParam, (int)n, (int)lI, 0, 0, EV_NOTIME);
+		enqEvent(0, hWnd, WM_DESTROY, wParam, (int)n, (int)lI, 0, 0, EV_NOTIME);
 #else
 		if (lI) {
 		    free(lI);
 		}
-		enqEvent(ENQ_AT_END, 0, hWnd, WM_DESTROY, wParam, (int)n, 0, 0, 0, EV_NOTIME);
+		enqEvent(0, hWnd, WM_DESTROY, wParam, (int)n, 0, 0, 0, EV_NOTIME);
 #endif
 		*pDefault = 0;
 		return 0;
@@ -2780,7 +2768,7 @@
 				}
 			    } else {
 				if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
-				    enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+				    enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
 				    SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 				}
 			    }
@@ -2792,7 +2780,7 @@
 			    delayedMouseEnterY = evRootY;
 			} else {
 			    if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
-				enqEvent(ENQ_AT_END, EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
+				enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
 				SetWindow_mouseXY(hWndChild, evRootX, evRootY);
 			    }
 			    //SetFocus(hWndChild);
@@ -2885,14 +2873,14 @@
 			EVENT_PRINTF(("iconified.\n"));
 			SetWindow_iconified(hWnd, 1);
 			DPRINTF(("WM_WINDOWPOSCHANGED to iconified (flags:0x%x)\n", wp->flags));
-			enqEvent(ENQ_AT_END, 0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
+			enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
 		    }
 		} else {
 		    if (GetWindow_iconified(hWnd)) {
 			EVENT_PRINTF(("deiconified.\n"));
 			SetWindow_iconified(hWnd, 0);
 			DPRINTF(("WM_WINDOWPOSCHANGED to deiconified (flags:0x%x)\n", wp->flags));
-			enqEvent(ENQ_AT_END, 0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
+			enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
 		    }
 		    if (!(wp->flags & SWP_NOSIZE) 
 		     || !(wp->flags & SWP_NOMOVE)) {
@@ -2911,7 +2899,7 @@
 			lastPos_y = y;
 			lastPos_win = hWnd;
 #endif
-			enqEvent(ENQ_AT_END, 0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
+			enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
 		    } else {
 			EVENT_PRINTF(("no event due to SWP_NOSIZE/SWP_NOMOVE.\n"));
 		    }
@@ -2984,7 +2972,7 @@
 		int retVal;
 
 # ifdef LATE_GENERATE_EXPOSE
-		enqEvent(ENQ_AT_END, 0, hWnd, __WM_PAINT, 0, 0, 0, 0, 0, EV_NOTIME);
+		enqEvent(0, hWnd, __WM_PAINT, 0, 0, 0, 0, 0, EV_NOTIME);
 # else
 		AQUIRE_DRAW_MUTEX
 		retVal = __generateExposes(hWnd, NULL, WM_PAINT, WM_PAINT_CLEAR_EARLY);
@@ -3040,12 +3028,12 @@
 			     */
 			    if (! GetWindow_iconified(hWnd)) {
 				SetWindow_iconified(hWnd, 1);
-				enqEvent(ENQ_AT_END, 0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
+				enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
 			    }
 			} else {
 			    if (GetWindow_iconified(hWnd)) {
 				SetWindow_iconified(hWnd, 0);
-				enqEvent(ENQ_AT_END, 0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
+				enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
 			    }
 			    EVENT_PRINTF(("enq event2 %x: %d, %d, %d, %d\n", hWnd, x, y, w, h));
 #ifdef COMPRESS_WINDOWPOSCHANGED
@@ -3062,7 +3050,7 @@
 			    lastPos_y = y;
 			    lastPos_win = hWnd;
 #endif
-			    enqEvent(ENQ_AT_END, 0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
+			    enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
 			}
 		   }
 		   break;
@@ -3075,12 +3063,12 @@
 
 	case WM_DROPFILES:
 	    EVENT_PRINTF(("WM_DROPFILES\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 	case WM_SHOWWINDOW:
 	    EVENT_PRINTF(("WM_SHOWWINDOW\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    if (isNative) {
 		return 0;
 	    }
@@ -3157,52 +3145,56 @@
 			__generateRecursiveExposes(hWnd, WM_PAINT);
 #endif /* sigh */
 
-#if 0
-			if (__currentCapture == CAPTURE_NONE) {
+			goto activeCommon;
+
+		    case WA_CLICKACTIVE:
+			EVENT_PRINTF2(("++ WM_ACTIVATE clkactive h=%x\n", hWnd));
+			goto activeCommon;
+
+		    default:
+			EVENT_PRINTF2(("WM_ACTIVATE ? h=%x\n", hWnd));
+activeCommon:
+
+#ifndef PRE_25_NOV_03
+			if ( __currentCapture == CAPTURE_NONE ) {
 			    POINT p;
-			    HWND hWndChild,hWndTemp;
+			    HWND  hWndChild;
 
 			    p.x = evRootX;
 			    p.y = evRootY;
-			    ScreenToClient(hWnd, &p);
-			    hWndChild = hWnd; //hWndChild = ChildWindowFromPoint(hWnd,p);
-			    do {
-				hWndTemp = hWndChild;
-				hWndChild = ChildWindowFromPointEx(hWndTemp,p,CWP_SKIPINVISIBLE|CWP_SKIPDISABLED|CWP_SKIPTRANSPARENT);
-			    } while ((hWndChild) && (hWndChild != hWndTemp));
-
-			    /*printf("WM_ACTIVATE active h=%x p=%d.%d in %x\n", hWnd,p.x,p.y,hWndChild);*/
-			    if (hWndChild && (hWndChild != __currentPointerView)) {
-				int modifiers;
-
-				modifiers = getModifiers();
+
+			    hWndChild = WindowFromPoint(p);
+
+			    if(hWndChild && (hWndChild != hWnd) ) {
+				if( ! IsChild(hWnd, hWndChild) ) {
+				    hWndChild = 0;
+				}
+			    }
+
+			    if( hWndChild != __currentPointerView ) {
+				int modifiers = getModifiers();
+
 				if (__currentPointerView) {
 				    if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
-					enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+					enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
 					SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 				    }
-				    __currentPointerView = 0;
 				}
-				if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
-				    enqEvent(ENQ_AT_END, EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
-				    SetWindow_mouseXY(hWndChild, evRootX, evRootY);
+				__currentPointerView = hWndChild;
+
+				if (__currentPointerView) {
+				    if (GetWindow_eventMask(__currentPointerView) & EnterWindowMask) {
+					enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, p.x, p.y, 0, modifiers, EV_NOTIME);
+					SetWindow_mouseXY(__currentPointerView, evRootX, evRootY);
+				    }
 				}
-				//SetFocus(hWndChild);
-				__currentPointerView = hWndChild;
 			    }
 			}
 #endif
 			break;
-
-		    case WA_CLICKACTIVE:
-			EVENT_PRINTF2(("WM_ACTIVATE clkactive h=%x\n", hWnd));
-			break;
-
-		    default:
-			EVENT_PRINTF2(("WM_ACTIVATE ? h=%x\n", hWnd));
-			break;
-		}
-		enqEvent(ENQ_AT_END, 0, hWnd, WM_ACTIVATE, wParam, 0, 0, 0, 0, EV_NOTIME);
+		}
+		enqEvent(0, hWnd, WM_ACTIVATE, wParam, 0, 0, 0, 0, EV_NOTIME);
+
 		if (isNative) {
 		    *pDefault = 1;
 		    return 0;
@@ -3259,9 +3251,9 @@
 		    y = p.y;
 
 		    if (evMask & KeyPressMask)
-			enqEvent(ENQ_AT_END, KeyPressMask, destWindow, WM_KEYDOWN, wParam, x, y, lParam, modifiers | TRANSLATED_KEY, evTime);
+			enqEvent(KeyPressMask, destWindow, WM_KEYDOWN, wParam, x, y, lParam, modifiers | TRANSLATED_KEY, evTime);
 		    if (evMask & KeyReleaseMask)
-			enqEvent(ENQ_AT_END, KeyReleaseMask, destWindow, WM_KEYUP, wParam, x, y, lParam, modifiers | TRANSLATED_KEY, evTime);
+			enqEvent(KeyReleaseMask, destWindow, WM_KEYUP, wParam, x, y, lParam, modifiers | TRANSLATED_KEY, evTime);
 		}
 	    }
 	    *pDefault = 0;
@@ -3301,7 +3293,7 @@
 		    y = p.y;
 
 		    modifiers = getModifiers();
-		    enqEvent(ENQ_AT_END, KeyReleaseMask, destWindow, message, wParam, x, y, lParam, modifiers, evTime);
+		    enqEvent(KeyReleaseMask, destWindow, message, wParam, x, y, lParam, modifiers, evTime);
 		}
 	    }
 	    *pDefault = 0;
@@ -3367,7 +3359,7 @@
 		    y = p.y;
 
 		    modifiers = getModifiers();
-		    enqEvent(ENQ_AT_END, KeyPressMask, destWindow, message, wParam, x, y, lParam, modifiers, evTime);
+		    enqEvent(KeyPressMask, destWindow, message, wParam, x, y, lParam, modifiers, evTime);
 		}
 	    }
 	    *pDefault = 0;
@@ -3403,7 +3395,7 @@
 		    if (evTime < lastMouseWheelTime) {
 			delta = (0xFFFFFFFF - lastMouseWheelTime) + evTime;
 		    }
-		    enqEvent(ENQ_AT_END, 0, destWindow, message, wParam, x, y, lParam, modifiers, delta);
+		    enqEvent(0, destWindow, message, wParam, x, y, lParam, modifiers, delta);
 		}
 		lastMouseWheelTime = evTime;
 	    }
@@ -3438,7 +3430,7 @@
 				}
 			    } else {
 				if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
-				    enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
+				    enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
 				    SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 				}
 			    }
@@ -3461,7 +3453,7 @@
 			    delayedMouseEnterY = y;
 			} else {
 			    if (GetWindow_eventMask(hWnd) & EnterWindowMask) {
-				enqEvent(ENQ_AT_END, EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, x, y, 0, modifiers, evTime);
+				enqEvent(EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, x, y, 0, modifiers, evTime);
 				SetWindow_mouseXY(hWnd, x, y);
 			    }
 			}
@@ -3487,7 +3479,7 @@
 			    if ((GetWindow_mouseX(__currentPointerView) == x)
 			     && (GetWindow_mouseY(__currentPointerView) == y)) {
 			    } else {
-				enqEvent(ENQ_AT_END, PointerMotionMask, __currentPointerView, WM_MOUSEMOVE, wParam, x, y, 0, modifiers, evTime);
+				enqEvent(PointerMotionMask, __currentPointerView, WM_MOUSEMOVE, wParam, x, y, 0, modifiers, evTime);
 				SetWindow_mouseXY(__currentPointerView, x, y);
 			    }
 			}
@@ -3526,7 +3518,7 @@
 		    __eatingMouseEvents = 0;
 		} else {
 		    modifiers = getModifiers();
-		    enqEvent(ENQ_AT_END, ButtonReleaseMask, hWnd, 
+		    enqEvent(ButtonReleaseMask, hWnd, 
 			     message, wParam, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam),
 			     wParam, modifiers, evTime);
 		}
@@ -3572,7 +3564,7 @@
 		    __eatingMouseEvents = 0;
 		} else {
 		    modifiers = getModifiers();
-		    enqEvent(ENQ_AT_END, ButtonPressMask, hWnd, 
+		    enqEvent(ButtonPressMask, hWnd, 
 			     message, wParam, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam),
 			     wParam, modifiers, evTime);
 		}
@@ -3591,7 +3583,7 @@
 
 	case WM_KILLFOCUS:
 	    CPRINTF(("WM_KILLFOCUS\n"));
-	    //enqEvent(ENQ_AT_END, 0,hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    //enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    if (isNative) {
 		*pDefault = 1;
 		return 0;
@@ -3602,7 +3594,7 @@
 	case WM_SETFOCUS:
 	    CPRINTF(("WM_SETFOCUS %x\n",hWnd));
 #if 0
-	    //enqEvent(ENQ_AT_END, 0,hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    //enqEvent(0,hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    {
 		POINT p;
 		HWND hWndChild,hWndTemp;
@@ -3624,13 +3616,13 @@
 			modifiers = getModifiers();
 			if (__currentPointerView) {
 			    if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask)
-				enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+				enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
 				SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 
 			    __currentPointerView = 0;
 			}
 			if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
-			    enqEvent(ENQ_AT_END, EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
+			    enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
 			    SetWindow_mouseXY(hWndChild, evRootX, evRootY);
 			}
 			//SetFocus(hWndChild);
@@ -3679,7 +3671,7 @@
 			    int modifiers;
 
 			    modifiers = getModifiers();
-			    enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
+			    enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
 			    SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 			}
 		    }
@@ -3976,7 +3968,7 @@
 
 	case WM_QUERYENDSESSION:
 	    EVENT_PRINTF(("WM_QUERYENDSESSION\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    // TODO: enter new event loop
 	    // which is left when an endSessionConfirmation
 	    // arrives from smalltalk
@@ -3989,22 +3981,22 @@
 
 	case WM_DISPLAYCHANGE:
 	    EVENT_PRINTF(("WM_DISPLAYCHANGE\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 	case WM_FONTCHANGE:
 	    EVENT_PRINTF(("WM_FONTCHANGE\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 	case WM_WININICHANGE:
 	    EVENT_PRINTF(("WM_WININICHANGE\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 	case WM_SYSCOLORCHANGE:
 	    EVENT_PRINTF(("WM_SYSCOLORCHANGE\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 	case WM_MOVING:
@@ -4040,14 +4032,14 @@
 
 		if (needDelayedMouseLeaveWindow) {
 		    if (GetWindow_eventMask(needDelayedMouseLeaveWindow) & LeaveWindowMask) {
-			enqEvent(ENQ_AT_END, LeaveWindowMask, needDelayedMouseLeaveWindow, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+			enqEvent(LeaveWindowMask, needDelayedMouseLeaveWindow, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
 			SetWindow_mouseXY(needDelayedMouseLeaveWindow, -9999, -9999);
 		    }
 		    needDelayedMouseLeaveWindow = NULL;
 		}
 		if (needDelayedMouseEnterWindow) {
 		    if (GetWindow_eventMask(needDelayedMouseEnterWindow) & EnterWindowMask) {
-			enqEvent(ENQ_AT_END, EnterWindowMask, needDelayedMouseEnterWindow, __WM_MOUSEENTER, 0, delayedMouseEnterX, delayedMouseEnterY, 0, modifiers, EV_NOTIME);
+			enqEvent(EnterWindowMask, needDelayedMouseEnterWindow, __WM_MOUSEENTER, 0, delayedMouseEnterX, delayedMouseEnterY, 0, modifiers, EV_NOTIME);
 			SetWindow_mouseXY(needDelayedMouseEnterWindow, delayedMouseEnterX, delayedMouseEnterY);
 		    }
 		    needDelayedMouseEnterWindow = NULL;
@@ -4061,7 +4053,7 @@
 
 	case WM_POWER:
 	    UNHANDLED_EVENT_PRINTF(("WM_POWER\n"));
-	    enqEvent(ENQ_AT_END, 0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+	    enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
 	    break;
 
 #if 0
@@ -4311,7 +4303,7 @@
 					}
 				    } else {
 					if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
-					    enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
+					    enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
 					    SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 					}
 				    }
@@ -4387,7 +4379,7 @@
 			    }
 			} else {
 			    if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
-				enqEvent(ENQ_AT_END, LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
+				enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
 				SetWindow_mouseXY(__currentPointerView, -9999, -9999);
 			    }
 			}
@@ -8493,7 +8485,7 @@
 		/*
 		 * no exposes generated - must send a NOEXPOSE
 		 */
-		enqEvent(ENQ_AT_END, ExposureMask, srcGcData->hWnd, __WM_NOGEXPOSE, 0, 0, 0, 0, 0, EV_NOTIME);
+		enqEvent(ExposureMask, srcGcData->hWnd, __WM_NOGEXPOSE, 0, 0, 0, 0, 0, EV_NOTIME);
 	    }
 
 	    if (dstRgn) {
@@ -10189,6 +10181,7 @@
 		x = ev->ev_x;
 		y = ev->ev_y;
 		state = ev->ev_modifiers;
+
 #ifdef DEBUG_WM_MOUSEENTER
 		PRINTF((">>> WM_MOUSEENTER: %x %d/%d state:%x\n", ev->ev_hWnd, x, y, state));
 #else
@@ -14487,7 +14480,7 @@
 
 //            ShowWindow(win, SW_SHOW);
 //            SetWindowPos(win, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|/*SWP_NOACTIVATE|*/SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
-//            enqEvent(ENQ_AT_END, 0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0, EV_NOTIME);
+//            enqEvent(0,win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0, EV_NOTIME);
 	}
 	RETURN ( self );
     }
@@ -14730,7 +14723,7 @@
 //                ShowWindow(win, SW_SHOWMINIMIZED);
 		ShowWindowAsync(win, SW_SHOWMINNOACTIVE);
 /*
-		enqEvent(ENQ_AT_END, 0, win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0, EV_NOTIME);
+		enqEvent(0, win, WM_SHOWWINDOW, FALSE, 0, 0, 0, 0, EV_NOTIME);
 */
 	    } else {
 		/* normal */
@@ -14738,7 +14731,7 @@
 			     __left, __top, __width, __height,
 			     flag);
 /*
-		enqEvent(ENQ_AT_END, 0, win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0, EV_NOTIME);
+		enqEvent(0, win, WM_SHOWWINDOW, TRUE, 0, 0, 0, 0, EV_NOTIME);
 */
 		//ShowWindow(win, SW_RESTORE);
 		// ShowWindowAsync(win, SW_RESTORE);
@@ -15534,6 +15527,6 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.236 2003-11-24 16:22:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.237 2003-11-25 18:56:17 ca Exp $'
 ! !
 WinWorkstation initialize!