[uxtheme]

- After doing any drawing operation for the non client area, restore the previously opened theme. Fixes GetWindowTheme

svn path=/branches/GSoC_2011/ThemesSupport/; revision=52639
This commit is contained in:
Giannis Adamopoulos 2011-07-11 18:17:11 +00:00
parent 832f3db5a1
commit 012c87272c
3 changed files with 5 additions and 1 deletions

View file

@ -4,6 +4,7 @@ typedef struct _DRAW_CONTEXT
HWND hWnd;
HDC hDC;
HTHEME theme;
HTHEME hPrevTheme;
WINDOWINFO wi;
BOOL Active; /* wi.dwWindowStatus isn't correct for mdi child windows */
HRGN hRgn;

View file

@ -165,6 +165,7 @@ ThemeInitDrawContext(PDRAW_CONTEXT pcontext,
GetWindowInfo(hWnd, &pcontext->wi);
pcontext->hWnd = hWnd;
pcontext->Active = IsWindowActive(hWnd, pcontext->wi.dwExStyle);
pcontext->hPrevTheme = GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWindowTheme));
pcontext->theme = OpenThemeData(pcontext->hWnd, L"WINDOW");
pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
@ -186,6 +187,8 @@ ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
CloseThemeData (pcontext->theme);
SetPropW(pcontext->hWnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), pcontext->hPrevTheme);
if(pcontext->hRgn != NULL)
{
DeleteObject(pcontext->hRgn);

View file

@ -61,7 +61,7 @@ HINSTANCE hDllInst;
ATOM atDialogThemeEnabled;
static DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS;
static ATOM atWindowTheme;
ATOM atWindowTheme;
static ATOM atSubAppName;
static ATOM atSubIdList;