WinWorkstation.st
changeset 3951 37e3af4c726e
parent 3895 31caf29bcda1
child 3958 cc150a3525b9
--- a/WinWorkstation.st	Wed Oct 29 11:45:21 2003 +0100
+++ b/WinWorkstation.st	Fri Oct 31 09:56:25 2003 +0100
@@ -561,6 +561,8 @@
 static HFONT __tmpDC_hfont = 0, __tmpDC_prev_hfont = 0;
 #endif
 static int __isWinNT = 0;
+static int __isWinNT_NEW_BEHAVIOUR = 0;
+
 static int __isWinXP = 0;
 static int __logPixelSY;
 
@@ -4308,12 +4310,17 @@
 #ifdef SET_CURSOR_IN_WINTHREAD
 	    case WM_THREAD_SETCURSOR:
 		if (msg.lParam) {
-		    POINT p;
-
-		    GetCursorPos(&p);
-		    if (WindowFromPoint(p) == msg.hwnd) {
-			EVENT_PRINTF(("threadSetCursor %x\n",msg.lParam));
+		    if( __isWinNT_NEW_BEHAVIOUR ) {
 			SetCursor((HCURSOR)msg.lParam);
+		    } else {
+		        POINT p;
+
+		        GetCursorPos(&p);
+
+		        if (WindowFromPoint(p) == msg.hwnd) {
+			    EVENT_PRINTF(("threadSetCursor %x\n",msg.lParam));
+			    SetCursor((HCURSOR)msg.lParam);
+                        }
 		    }
 		}
 		continue;
@@ -12192,10 +12199,13 @@
 	__INST(isWin95) = true;
 	__INST(isWinXP) = false;
 	__isWinNT = __isWinXP = 0;
+	__isWinNT_NEW_BEHAVIOUR = 0;
 
 	if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
 	    __INST(isWin95) = false;
 	    __isWinNT = 1;
+	    __isWinNT_NEW_BEHAVIOUR = 1;
+
 	    if ((osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1)) {
 		__INST(isWinXP) = true;
 		__isWinXP = 1;
@@ -14973,22 +14983,28 @@
      && __isExternalAddress(aWindowId)
      && __isExternalAddress(aCursorId)) {
 	HWND win = _HWNDVal(aWindowId);
-	POINT p;
-
-	/*printf("setCursor:in:\n");*/
+
 	SetWindow_Cursor(win, _HCURSORVal(aCursorId));
 
-	/*
-	 * if the pointer is currently in that window ...
-	 */
-	GetCursorPos(&p);
-	if (WindowFromPoint(p) == win) {
+	if( ! __isWinNT_NEW_BEHAVIOUR )
+	{
+	    /*
+	     * test whether the pointer is currently in that window ...
+	     */
+	    POINT p;
+	    GetCursorPos(&p);
+	    if (WindowFromPoint(p) != win) {
+		RETURN ( self );
+	    }
+	}
+        SetWindow_Cursor(win, _HCURSORVal(aCursorId));
+
 #ifdef SET_CURSOR_IN_WINTHREAD
-	    PostMessage(win, WM_THREAD_SETCURSOR, 0, (INT)_HCURSORVal(aCursorId));
+	PostMessage(win, WM_THREAD_SETCURSOR, 0, (INT)_HCURSORVal(aCursorId));
 #else
-	    SetCursor(_HCURSORVal(aCursorId));
-#endif
-	}
+	SetCursor(_HCURSORVal(aCursorId));
+#endif
+
 	RETURN ( self );
     }
 %}
@@ -15442,6 +15458,6 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.233 2003-05-30 08:56:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.234 2003-10-31 08:56:25 ca Exp $'
 ! !
 WinWorkstation initialize!