Author: gadamopoulos Date: Tue Aug 2 13:38:58 2011 New Revision: 53026
URL: http://svn.reactos.org/svn/reactos?rev=53026&view=rev Log: [uxtheme] - Do not try to load the current theme when uxtheme loads. Instead, load the current theme when theme hooks are installed or when the application receives a WM_THEMECHANGED message. This allows us to change themes without restarting the running applications. - Use the default behaviour of DefWindowProc from user32 when themes are not active. This allows us to have api hooks enabled when themes are disabled.
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/system.c branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxthemedll.h
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/system.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/system.c [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/system.c [iso-8859-1] Tue Aug 2 13:38:58 2011 @@ -148,7 +148,7 @@ * * Set the current active theme from the registry */ -static void UXTHEME_LoadTheme(void) +void UXTHEME_LoadTheme(void) { HKEY hKey; DWORD buffsize; @@ -542,8 +542,6 @@ atSubAppName = GlobalAddAtomW(szSubAppName); atSubIdList = GlobalAddAtomW(szSubIdList); atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled); - - UXTHEME_LoadTheme(); }
/***********************************************************************
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c [iso-8859-1] Tue Aug 2 13:38:58 2011 @@ -29,6 +29,14 @@ static LRESULT CALLBACK ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { + if(!IsThemeActive()) + { + return user32ApiHook.DefWindowProcW(hWnd, + Msg, + wParam, + lParam); + } + return ThemeWndProc(hWnd, Msg, wParam, @@ -39,11 +47,32 @@ static LRESULT CALLBACK ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { + if(!IsThemeActive()) + { + return user32ApiHook.DefWindowProcA(hWnd, + Msg, + wParam, + lParam); + } + return ThemeWndProc(hWnd, Msg, wParam, lParam, user32ApiHook.DefWindowProcA); +} + +static LRESULT CALLBACK +ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret,PDWORD unknown) +{ + switch(Msg) + { + case WM_THEMECHANGED: + UXTHEME_LoadTheme(); + return 0; + } + + return 0; }
BOOL CALLBACK @@ -60,6 +89,7 @@
puah->DefWindowProcA = ThemeDefWindowProcA; puah->DefWindowProcW = ThemeDefWindowProcW; + puah->PreWndProc = ThemePreWindowProc; puah->DefWndProcArray.MsgBitArray = gabDWPmessages; puah->DefWndProcArray.Size = UAHOWP_MAX_SIZE; puah->WndProcArray.MsgBitArray = gabMSGPmessages; @@ -100,7 +130,7 @@ UAH_HOOK_MESSAGE(puah->WndProcArray, WM_THEMECHANGED); UAH_HOOK_MESSAGE(puah->WndProcArray, WM_UAHINIT);
- UXTHEME_InitSystem(hDllInst); + UXTHEME_LoadTheme();
return TRUE; }
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxthemedll.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxthemedll.h [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxthemedll.h [iso-8859-1] Tue Aug 2 13:38:58 2011 @@ -95,6 +95,7 @@ ParseThemeIniFileProc callback, LPVOID lpData);
extern void UXTHEME_InitSystem(HINSTANCE hInst); +extern void UXTHEME_LoadTheme(void);
/* No alpha blending */ #define ALPHABLEND_NONE 0