[UXTHEME] -Implement taking into account the flags set by SetThemeAppProperties. Now the shim that disables themes per application works.

svn path=/trunk/; revision=75514
This commit is contained in:
Giannis Adamopoulos 2017-08-09 08:14:50 +00:00
parent 61427a2eaf
commit 7e43b947a1
2 changed files with 37 additions and 5 deletions

View file

@ -747,6 +747,18 @@ OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DW
return NULL;
}
if ((flags & OTD_NONCLIENT) && !(dwThemeAppProperties & STAP_ALLOW_NONCLIENT))
{
SetLastError(E_PROP_ID_UNSUPPORTED);
return NULL;
}
if (!(flags & OTD_NONCLIENT) && !(dwThemeAppProperties & STAP_ALLOW_CONTROLS))
{
SetLastError(E_PROP_ID_UNSUPPORTED);
return NULL;
}
if (ThemeFile)
{
pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));

View file

@ -98,6 +98,16 @@ HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style)
if (pwndData == NULL)
return NULL;
if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
{
if (pwndData->hthemeWindow)
{
CloseThemeData(pwndData->hthemeWindow);
pwndData->hthemeWindow = NULL;
}
return NULL;
}
/* If the theme data was not cached, open it now */
if (!pwndData->hthemeWindow)
pwndData->hthemeWindow = OpenThemeDataEx(hWnd, L"WINDOW", OTD_NONCLIENT);
@ -118,6 +128,16 @@ HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style)
if (pwndData == NULL)
return NULL;
if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
{
if (pwndData->hthemeScrollbar)
{
CloseThemeData(pwndData->hthemeScrollbar);
pwndData->hthemeScrollbar = NULL;
}
return NULL;
}
/* If the theme data was not cached, open it now */
if (!pwndData->hthemeScrollbar)
pwndData->hthemeScrollbar = OpenThemeDataEx(hWnd, L"SCROLLBAR", OTD_NONCLIENT);
@ -222,7 +242,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
if (pwndData->UpdatingRgn == TRUE)
return 0;
if(!IsAppThemed())
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
{
if(pwndData->HasThemeRgn)
{
@ -248,7 +268,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
static LRESULT CALLBACK
ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if(!IsAppThemed())
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
{
return g_user32ApiHook.DefWindowProcW(hWnd,
Msg,
@ -266,7 +286,7 @@ ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK
ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if(!IsAppThemed())
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
{
return g_user32ApiHook.DefWindowProcA(hWnd,
Msg,
@ -456,7 +476,7 @@ ThemeDlgPostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_
HBRUSH* phbrush = (HBRUSH*)ret;
HTHEME hTheme;
if (!IsAppThemed())
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
break;
if (!IsThemeDialogTextureEnabled (hWnd))
@ -507,7 +527,7 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
BOOL ret;
/* Avoid creating a window context if it is not needed */
if(!IsAppThemed())
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
goto dodefault;
style = GetWindowLongW(hwnd, GWL_STYLE);