diff --git a/dll/win32/uxtheme/nonclient.c b/dll/win32/uxtheme/nonclient.c index 4171e09264d..1ff26a32184 100644 --- a/dll/win32/uxtheme/nonclient.c +++ b/dll/win32/uxtheme/nonclient.c @@ -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; diff --git a/dll/win32/uxtheme/themehooks.c b/dll/win32/uxtheme/themehooks.c index 99811808f7a..583fce34d4f 100644 --- a/dll/win32/uxtheme/themehooks.c +++ b/dll/win32/uxtheme/themehooks.c @@ -323,7 +323,8 @@ ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR case WM_SIZE: case WM_WINDOWPOSCHANGED: { - ThemeCalculateCaptionButtonsPos(hWnd, NULL); + if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT)) + ThemeCalculateCaptionButtonsPos(hWnd, NULL); break; } case WM_THEMECHANGED: @@ -360,7 +361,11 @@ ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR pwndData->hthemeScrollbar = NULL; } - ThemeCalculateCaptionButtonsPos(hWnd, NULL); + if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT)) + ThemeCalculateCaptionButtonsPos(hWnd, NULL); + + pwndData->DirtyThemeRegion = TRUE; + break; } case WM_NCCREATE: {