Gabriel Ivăncescu : user32: Keep toplevel minimized windows offscreen if they're already.

Alexandre Julliard julliard at winehq.org
Thu Feb 4 16:15:20 CST 2021


Module: wine
Branch: master
Commit: dd417540bb3afb3aa5a04a007eea9a7ee347655b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dd417540bb3afb3aa5a04a007eea9a7ee347655b

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Feb  4 18:34:38 2021 +0200

user32: Keep toplevel minimized windows offscreen if they're already.

Some applications (e.g. Lego Worlds, Hitman 2) use (-32000,-32000) to
determine whether a window is minimized.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/win.c | 3 ---
 dlls/user32/winpos.c    | 8 ++++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index c457ce16d4e..eecccb70001 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -11574,7 +11574,6 @@ todo_wine
     ret = GetWindowPlacement(hwnd, &wp);
     ok(ret, "failed to get window placement, error %u\n", GetLastError());
     ok(wp.showCmd == SW_SHOWMINIMIZED, "got show cmd %u\n", wp.showCmd);
-todo_wine
     ok(wp.ptMinPosition.x == -32000 && wp.ptMinPosition.y == -32000,
         "got minimized pos (%d,%d)\n", wp.ptMinPosition.x, wp.ptMinPosition.y);
 todo_wine
@@ -11583,7 +11582,6 @@ todo_wine
     ok(EqualRect(&wp.rcNormalPosition, &orig), "got normal pos %s\n",
         wine_dbgstr_rect(&wp.rcNormalPosition));
     GetWindowRect(hwnd, &rect);
-todo_wine
     ok(rect.left == -32000 && rect.top == -32000, "got window rect %s\n", wine_dbgstr_rect(&rect));
 
     ShowWindow(hwnd, SW_SHOWNORMAL);
@@ -11591,7 +11589,6 @@ todo_wine
     ret = GetWindowPlacement(hwnd, &wp);
     ok(ret, "failed to get window placement, error %u\n", GetLastError());
     ok(wp.showCmd == SW_NORMAL, "got show cmd %u\n", wp.showCmd);
-todo_wine
     ok(wp.ptMinPosition.x == -32000 && wp.ptMinPosition.y == -32000,
         "got minimized pos (%d,%d)\n", wp.ptMinPosition.x, wp.ptMinPosition.y);
 todo_wine
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 9e5a0c238af..072b574f3aa 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1688,6 +1688,14 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS *pWinpos, RECT *old_window_rect, REC
     }
     if (!(pWinpos->flags & SWP_NOMOVE))
     {
+        /* If the window is toplevel minimized off-screen, force keep it there */
+        if ((wndPtr->dwStyle & WS_MINIMIZE) &&
+             wndPtr->window_rect.left <= -32000 && wndPtr->window_rect.top <= -32000 &&
+            (!wndPtr->parent || wndPtr->parent == GetDesktopWindow()))
+        {
+            pWinpos->x = -32000;
+            pWinpos->y = -32000;
+        }
         new_window_rect->left    = pWinpos->x;
         new_window_rect->top     = pWinpos->y;
         new_window_rect->right  += pWinpos->x - old_window_rect->left;




More information about the wine-cvs mailing list