[UXTHEME] Fix a series of problems regarding ThemeCalculateCaptionButtonsPos

Only call it when needed. Also make it fail properly if the window theme could not be opened.
CORE-15564
This commit is contained in:
Giannis Adamopoulos 2019-01-07 11:38:42 +02:00
parent e6a1851684
commit 88a69b446b
2 changed files with 12 additions and 3 deletions

View file

@ -230,7 +230,11 @@ void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme)
return;
if (!htheme)
htheme = pwndData->hthemeWindow;
{
htheme = GetNCCaptionTheme(hWnd, style);
if (!htheme)
return;
}
if(!GetWindowInfo(hWnd, &wi))
return;

View file

@ -323,6 +323,7 @@ ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR
case WM_SIZE:
case WM_WINDOWPOSCHANGED:
{
if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
ThemeCalculateCaptionButtonsPos(hWnd, NULL);
break;
}
@ -360,7 +361,11 @@ ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR
pwndData->hthemeScrollbar = NULL;
}
if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
ThemeCalculateCaptionButtonsPos(hWnd, NULL);
pwndData->DirtyThemeRegion = TRUE;
break;
}
case WM_NCCREATE:
{