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