[UXTHEME] -Implement taking into account the flags set by SetThemeAppProperties....
authorgadamopoulos <gadamopoulos@97493ccd-5924-5043-b1f5-66cb403b36ce>
Wed, 9 Aug 2017 08:14:50 +0000 (08:14 +0000)
committergadamopoulos <gadamopoulos@97493ccd-5924-5043-b1f5-66cb403b36ce>
Wed, 9 Aug 2017 08:14:50 +0000 (08:14 +0000)
git-svn-id: file:///srv/svn/reactos/trunk@75514 97493ccd-5924-5043-b1f5-66cb403b36ce

reactos/dll/win32/uxtheme/system.c
reactos/dll/win32/uxtheme/themehooks.c

index fce5904..1b3f8c6 100644 (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]));
index abd1940..f1dd079 100644 (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);