Alexandre Julliard : user: Maximize windows to the right monitor on multi-monitor setups.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 23 10:01:15 CDT 2006


Module: wine
Branch: master
Commit: 280defcfcf478d825bd565e7af292ef217aef7fe
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=280defcfcf478d825bd565e7af292ef217aef7fe

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct 23 14:04:52 2006 +0200

user: Maximize windows to the right monitor on multi-monitor setups.

---

 dlls/user/winpos.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/user/winpos.c b/dlls/user/winpos.c
index c9307cd..9e91bc4 100644
--- a/dlls/user/winpos.c
+++ b/dlls/user/winpos.c
@@ -727,6 +727,7 @@ void WINPOS_GetMinMaxInfo( HWND hwnd, PO
 {
     LPINTERNALPOS lpPos;
     MINMAXINFO MinMax;
+    HMONITOR monitor;
     INT xinc, yinc;
     LONG style = GetWindowLongA( hwnd, GWL_STYLE );
     LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
@@ -759,8 +760,8 @@ void WINPOS_GetMinMaxInfo( HWND hwnd, PO
     }
     MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
     MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
-    MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN) + 2*GetSystemMetrics(SM_CXFRAME);
-    MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN) + 2*GetSystemMetrics(SM_CYFRAME);
+    MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXMAXTRACK);
+    MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYMAXTRACK);
 
     if (HAS_DLGFRAME( style, exstyle ))
     {
@@ -798,6 +799,28 @@ void WINPOS_GetMinMaxInfo( HWND hwnd, PO
 
     SendMessageW( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
 
+    /* if the app didn't change the values, adapt them for the current monitor */
+
+    if ((monitor = MonitorFromWindow( hwnd, MONITOR_DEFAULTTOPRIMARY )))
+    {
+        MONITORINFO mon_info;
+
+        mon_info.cbSize = sizeof(mon_info);
+        GetMonitorInfoW( monitor, &mon_info );
+
+        if (MinMax.ptMaxSize.x == GetSystemMetrics(SM_CXSCREEN) &&
+            MinMax.ptMaxSize.y == GetSystemMetrics(SM_CYSCREEN))
+        {
+            MinMax.ptMaxSize.x = mon_info.rcWork.right - mon_info.rcWork.left;
+            MinMax.ptMaxSize.y = mon_info.rcWork.bottom - mon_info.rcWork.top;
+        }
+        if (MinMax.ptMaxPosition.x == -xinc && MinMax.ptMaxPosition.y == -yinc)
+        {
+            MinMax.ptMaxPosition.x = mon_info.rcWork.left - xinc;
+            MinMax.ptMaxPosition.y = mon_info.rcWork.top - yinc;
+        }
+    }
+
       /* Some sanity checks */
 
     TRACE("%d %d / %d %d / %d %d / %d %d\n",




More information about the wine-cvs mailing list