mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[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. svn path=/branches/GSoC_2011/ThemesSupport/; revision=53026
This commit is contained in:
parent
23e86250fb
commit
e3a05782a8
3 changed files with 33 additions and 4 deletions
|
@ -148,7 +148,7 @@ static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue,
|
|||
*
|
||||
* 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 @@ void UXTHEME_InitSystem(HINSTANCE hInst)
|
|||
atSubAppName = GlobalAddAtomW(szSubAppName);
|
||||
atSubIdList = GlobalAddAtomW(szSubIdList);
|
||||
atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled);
|
||||
|
||||
UXTHEME_LoadTheme();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -29,6 +29,14 @@ BYTE gabMSGPmessages[UAHOWP_MAX_SIZE];
|
|||
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,6 +47,14 @@ ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|||
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,
|
||||
|
@ -46,6 +62,19 @@ ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM 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
|
||||
ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
||||
{
|
||||
|
@ -60,6 +89,7 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
|||
|
||||
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 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
|||
UAH_HOOK_MESSAGE(puah->WndProcArray, WM_THEMECHANGED);
|
||||
UAH_HOOK_MESSAGE(puah->WndProcArray, WM_UAHINIT);
|
||||
|
||||
UXTHEME_InitSystem(hDllInst);
|
||||
UXTHEME_LoadTheme();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
|
|||
ParseThemeIniFileProc callback, LPVOID lpData);
|
||||
|
||||
extern void UXTHEME_InitSystem(HINSTANCE hInst);
|
||||
extern void UXTHEME_LoadTheme(void);
|
||||
|
||||
/* No alpha blending */
|
||||
#define ALPHABLEND_NONE 0
|
||||
|
|
Loading…
Reference in a new issue