fixed: #monitorHandleForPoint:
authorClaus Gittinger <cg@exept.de>
Wed, 03 Feb 2010 18:03:37 +0100
changeset 5549 fd4fc69df52d
parent 5548 4bc2de4d03f9
child 5550 97fb2638d5d8
fixed: #monitorHandleForPoint:
WinWorkstation.st
--- a/WinWorkstation.st	Wed Feb 03 00:15:56 2010 +0100
+++ b/WinWorkstation.st	Wed Feb 03 18:03:37 2010 +0100
@@ -6981,55 +6981,56 @@
      isPrimary mName|
 %{
     if (__isExternalAddress(aMonitorId)) {
-	HMONITOR hMonitor = _HWNDVal(aMonitorId);
-	MONITORINFOEX info;
-
-	info.cbSize = sizeof(MONITORINFOEX);
+        HMONITOR hMonitor = _HWNDVal(aMonitorId);
+        MONITORINFOEX info;
+
+        info.cbSize = sizeof(MONITORINFOEX);
 #if 0
-	static BOOL (__stdcall *P_GetMonitorInfo)(HMONITOR , MONITORINFOEX *);
-
-	if (P_GetMonitorInfo == 0) {
-	    HINSTANCE hUser = LoadLibrary("user32.dll");
-	    // console_printf("hUser: %x\n", hUser);
-	    if (hUser) {
-		P_GetMonitorInfo = (BOOL (__stdcall *)(HMONITOR, MONITORINFOEX * ))
-				    GetProcAddress(hUser, "GetMonitorInfo");
-	    }
-	}
-	console_printf("P_GetMonitorInfo: %x\n", P_GetMonitorInfo);
-	if ((*P_GetMonitorInfo)(hMonitor, &info))
-#else
-	if (GetMonitorInfo(hMonitor, &info))
-#endif
-	{
-	    // console_printf("l %d\n", info.rcMonitor.left);
-	    screenL = __MKSMALLINT(info.rcMonitor.left);
-	    screenT = __MKSMALLINT(info.rcMonitor.top);
-	    screenR = __MKSMALLINT(info.rcMonitor.right);
-	    screenB = __MKSMALLINT(info.rcMonitor.bottom);
-	    workL = __MKSMALLINT(info.rcWork.left);
-	    workT = __MKSMALLINT(info.rcWork.top);
-	    workR = __MKSMALLINT(info.rcWork.right);
-	    workB = __MKSMALLINT(info.rcWork.bottom);
-	    isPrimary = (info.dwFlags & MONITORINFOF_PRIMARY) ? true : false;
-	    info.szDevice[31] = '\0';
-	    mName = __MKSTRING(info.szDevice);
-	}
+        static BOOL (__stdcall *P_GetMonitorInfo)(HMONITOR , MONITORINFOEX *);
+
+        if (P_GetMonitorInfo == 0) {
+            HINSTANCE hUser = LoadLibrary("user32.dll");
+            // console_printf("hUser: %x\n", hUser);
+            if (hUser) {
+                P_GetMonitorInfo = (BOOL (__stdcall *)(HMONITOR, MONITORINFOEX * ))
+                                    GetProcAddress(hUser, "GetMonitorInfo");
+            }
+        }
+        console_printf("P_GetMonitorInfo: %x\n", P_GetMonitorInfo);
+        if ((*P_GetMonitorInfo)(hMonitor, &info))
+#else
+        if (GetMonitorInfo(hMonitor, &info))
+#endif
+        {
+            // console_printf("l %d\n", info.rcMonitor.left);
+            screenL = __MKSMALLINT(info.rcMonitor.left);
+            screenT = __MKSMALLINT(info.rcMonitor.top);
+            screenR = __MKSMALLINT(info.rcMonitor.right);
+            screenB = __MKSMALLINT(info.rcMonitor.bottom);
+            workL = __MKSMALLINT(info.rcWork.left);
+            workT = __MKSMALLINT(info.rcWork.top);
+            workR = __MKSMALLINT(info.rcWork.right);
+            workB = __MKSMALLINT(info.rcWork.bottom);
+            isPrimary = (info.dwFlags & MONITORINFOF_PRIMARY) ? true : false;
+            info.szDevice[31] = '\0';
+            mName = __MKSTRING(info.szDevice);
+        }
     }
 %}.
     screenL isNil ifTrue:[ ^ nil ].
 
     ^ MonitorInfo new
-	screenX:screenL screenY:screenT
-	screenWidth:(screenR-screenL) screenHeight:(screenB-screenT)
-	workX:workL workY:workT
-	workWidth:(workR-workL) workHeight:(workB-workT)
-	isPrimary:isPrimary
-	name:mName
+        screenX:screenL screenY:screenT
+        screenWidth:(screenR-screenL) screenHeight:(screenB-screenT)
+        workX:workL workY:workT
+        workWidth:(workR-workL) workHeight:(workB-workT)
+        isPrimary:isPrimary
+        name:mName
 
     "
      Screen current monitorInfoFor:(Screen current monitorHandleForView:(Transcript topView id))
      Screen current monitorInfoFor:(Screen current monitorHandleForPoint:(0@0))
+     Screen current monitorInfoFor:(Screen current monitorHandleForPoint:(Display pointFromUser))
     "
 !
 
@@ -14913,37 +14914,38 @@
     pY := aPoint y.
 %{
     if (__bothSmallInteger(pX, pY)) {
-	POINT p;
-	HMONITOR hMonitor;
-	p.x = pX;
-	p.y = pY;
+        POINT p;
+        HMONITOR hMonitor;
+        p.x = __intVal(pX);
+        p.y = __intVal(pY);
 #if 0
-	static HMONITOR (__stdcall *P_MonitorFromPoint)(POINT, int);
-
-	if (P_MonitorFromPoint == 0) {
-	    HINSTANCE hUser = LoadLibrary("user32.dll");
-	    // console_printf("hUser: %x\n", hUser);
-	    if (hUser) {
-		P_MonitorFromPoint = (HMONITOR (__stdcall *)(POINT, int ))
-				    GetProcAddress(hUser, "MonitorFromPoint");
-	    }
-	}
-	// console_printf("P_MonitorFromPoint: %x\n", P_MonitorFromPoint);
-
-	hMonitor = (*P_MonitorFromPoint)(p, MONITOR_DEFAULTTONULL);
-#else
-	hMonitor = MonitorFromPoint(p, MONITOR_DEFAULTTONULL);
-#endif
-	if (hMonitor == 0) {
-	    RETURN(nil);
-	}
-	RETURN ( __MKEXTERNALADDRESS(hMonitor) );
+        static HMONITOR (__stdcall *P_MonitorFromPoint)(POINT, int);
+
+        if (P_MonitorFromPoint == 0) {
+            HINSTANCE hUser = LoadLibrary("user32.dll");
+            // console_printf("hUser: %x\n", hUser);
+            if (hUser) {
+                P_MonitorFromPoint = (HMONITOR (__stdcall *)(POINT, int ))
+                                    GetProcAddress(hUser, "MonitorFromPoint");
+            }
+        }
+        // console_printf("P_MonitorFromPoint: %x\n", P_MonitorFromPoint);
+
+        hMonitor = (*P_MonitorFromPoint)(p, MONITOR_DEFAULTTONULL);
+#else
+        hMonitor = MonitorFromPoint(p, MONITOR_DEFAULTTONULL);
+#endif
+        if (hMonitor == 0) {
+            RETURN(nil);
+        }
+        RETURN ( __MKEXTERNALADDRESS(hMonitor) );
     }
 %}
     "
      Screen current monitorHandleForPoint:(0@0)
      Screen current monitorHandleForPoint:(1500@0)
      Screen current monitorHandleForPoint:(3000@0)
+     Screen current monitorHandleForPoint:(Display pointFromUser)
     "
 !
 
@@ -18844,11 +18846,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.418 2010-02-01 18:16:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.419 2010-02-03 17:03:37 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.418 2010-02-01 18:16:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.419 2010-02-03 17:03:37 cg Exp $'
 ! !
 
 WinWorkstation initialize!