[PATCH] user32: Don't draw a close button if it doesn't exist.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/user32/nonclient.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 4444a2c91e..eec4d2abed 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -892,10 +892,12 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, DWORD style, hSysMenu = GetSystemMenu(hwnd, FALSE); state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); - /* Draw a grayed close button if disabled or if SC_CLOSE is not there */ - NC_DrawCloseButton (hwnd, hdc, FALSE, - (state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF)); - r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + /* Draw a grayed close button if disabled */ + if (state != 0xFFFFFFFF) + { + NC_DrawCloseButton (hwnd, hdc, FALSE, state & (MF_DISABLED | MF_GRAYED)); + r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + } if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX)) { -- 2.19.1
Zhiyi Zhang <zzhang(a)codeweavers.com> writes:
@@ -892,10 +892,12 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, DWORD style, hSysMenu = GetSystemMenu(hwnd, FALSE); state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
- /* Draw a grayed close button if disabled or if SC_CLOSE is not there */ - NC_DrawCloseButton (hwnd, hdc, FALSE, - (state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF)); - r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + /* Draw a grayed close button if disabled */ + if (state != 0xFFFFFFFF) + { + NC_DrawCloseButton (hwnd, hdc, FALSE, state & (MF_DISABLED | MF_GRAYED)); + r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + }
This doesn't seem to match the Windows behavior. Why do you need this? -- Alexandre Julliard julliard(a)winehq.org
On 2018/10/30 17:47, Alexandre Julliard wrote:
Zhiyi Zhang <zzhang(a)codeweavers.com> writes:
@@ -892,10 +892,12 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, DWORD style, hSysMenu = GetSystemMenu(hwnd, FALSE); state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
- /* Draw a grayed close button if disabled or if SC_CLOSE is not there */ - NC_DrawCloseButton (hwnd, hdc, FALSE, - (state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF)); - r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + /* Draw a grayed close button if disabled */ + if (state != 0xFFFFFFFF) + { + NC_DrawCloseButton (hwnd, hdc, FALSE, state & (MF_DISABLED | MF_GRAYED)); + r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; + } This doesn't seem to match the Windows behavior. Why do you need this?
Right. The behavior seems inconsistent. Windows with SC_CLOSE removed from sysmenu still have a close button. But task dialog doesn't have close button at all and this remove it. Please ignore this patch then, it's more of a UI conformance and it's not fixing any bugs anyway.
participants (2)
-
Alexandre Julliard -
Zhiyi Zhang