[UXTHEME] Properly show disabled close button

CORE-17203
This commit is contained in:
Stanislav Motylkov 2020-08-16 17:34:38 +03:00
parent 2fb2f1e4c5
commit 685084b63c
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92

View file

@ -277,6 +277,8 @@ ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
INT iStateId)
{
INT iPartId;
HMENU SysMenu;
UINT MenuState;
PWND_DATA pwndData = ThemeGetWndData(pcontext->hWnd);
if (!pwndData)
return;
@ -284,6 +286,13 @@ ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
switch(buttonId)
{
case CLOSEBUTTON:
SysMenu = GetSystemMenu(pcontext->hWnd, FALSE);
MenuState = GetMenuState(SysMenu, SC_CLOSE, MF_BYCOMMAND);
if (!(pcontext->wi.dwStyle & WS_SYSMENU) || (MenuState & (MF_GRAYED | MF_DISABLED)) || pcontext->wi.dwStyle & CS_NOCLOSE)
{
iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
}
iPartId = pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
break;