[PATCH 2/2] user32: Replace the minimize box with a restore box when the window is minimized.

Zebediah Figura z.figura12 at gmail.com
Tue Feb 19 19:10:35 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/user32/nonclient.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 372b1be707..0aee13787a 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -749,13 +749,15 @@ static void NC_DrawMaxButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
 static void  NC_DrawMinButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
 {
     RECT rect;
-    UINT flags = DFCS_CAPTIONMIN;
+    UINT flags;
     DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
     DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
 
     /* never draw minimize box when window has WS_EX_TOOLWINDOW style */
     if (ex_style & WS_EX_TOOLWINDOW) return;
 
+    flags = (style & WS_MINIMIZE) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMIN;
+
     NC_GetInsideRect( hwnd, COORDS_WINDOW, &rect, style, ex_style );
     if (style & WS_SYSMENU)
         rect.right -= GetSystemMetrics(SM_CXSIZE);
@@ -1245,7 +1247,8 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
         return;
 
     if (wParam == HTMINBUTTON)
-        SendMessageW( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, MAKELONG(msg.pt.x,msg.pt.y) );
+        SendMessageW( hwnd, WM_SYSCOMMAND,
+                      IsIconic(hwnd) ? SC_RESTORE : SC_MINIMIZE, MAKELONG(msg.pt.x,msg.pt.y) );
     else
         SendMessageW( hwnd, WM_SYSCOMMAND,
                       IsZoomed(hwnd) ? SC_RESTORE:SC_MAXIMIZE, MAKELONG(msg.pt.x,msg.pt.y) );
-- 
2.20.1




More information about the wine-devel mailing list