Ken Thomases : user32: Respect monitor work area when sizing or moving a top-level window.

Alexandre Julliard julliard at winehq.org
Fri Dec 13 12:46:28 CST 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu Dec 12 16:49:48 2013 -0600

user32: Respect monitor work area when sizing or moving a top-level window.

This prevents dragging a window's title bar behind a menu bar across the top
of a screen, for example.

---

 dlls/user32/winpos.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 22ee290..7cae0ad 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2625,6 +2625,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
     BOOL    moved = FALSE;
     DWORD     dwPoint = GetMessagePos ();
     BOOL DragFullWindows = TRUE;
+    HMONITOR mon = 0;
 
     if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) return;
 
@@ -2673,6 +2674,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
     {
         parent = 0;
         mouseRect = get_virtual_screen_rect();
+        mon = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
     }
 
     if (ON_LEFT_BORDER(hittest))
@@ -2749,6 +2751,24 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
         pt.y = max( pt.y, mouseRect.top );
         pt.y = min( pt.y, mouseRect.bottom );
 
+        if (!parent)
+        {
+            HMONITOR newmon;
+            MONITORINFO info;
+
+            if ((newmon = MonitorFromPoint( pt, MONITOR_DEFAULTTONULL )))
+                mon = newmon;
+
+            info.cbSize = sizeof(info);
+            if (mon && GetMonitorInfoW( mon, &info ))
+            {
+                pt.x = max( pt.x, info.rcWork.left );
+                pt.x = min( pt.x, info.rcWork.right );
+                pt.y = max( pt.y, info.rcWork.top );
+                pt.y = min( pt.y, info.rcWork.bottom );
+            }
+        }
+
         dx = pt.x - capturePoint.x;
         dy = pt.y - capturePoint.y;
 




More information about the wine-cvs mailing list