# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1337065769 0 # Node ID 3828f3faec8c41de4963755b260af678a4641c90 # Parent 570a03dabdc2bd4526305883087fc3fbb32c6f74 Had to move uxtheme/SetWindowTheme out of the AERO #ifdefs to get it to function on Windows XP. diff -r 570a03dabdc2 -r 3828f3faec8c win/dw.c --- a/win/dw.c Tue May 15 06:49:27 2012 +0000 +++ b/win/dw.c Tue May 15 07:09:29 2012 +0000 @@ -213,12 +213,14 @@ HRESULT (WINAPI *_DrawThemeTextEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const DTTOPTS *pOptions) = 0; HRESULT (WINAPI *_EndBufferedPaint)(HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget) = 0; HRESULT (WINAPI *_CloseThemeData)(HTHEME hTheme) = 0; -HRESULT (WINAPI *_SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList) = 0; BOOL _dw_composition = FALSE; COLORREF _dw_transparencykey = RGB(200,201,202); -HANDLE hdwm = 0, huxtheme = 0; +HANDLE hdwm = 0; #endif - +/* Aero related but separate functions and handles */ +HRESULT (WINAPI *_SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList) = 0; +HANDLE huxtheme = 0; + /* Needed for Rich Edit controls */ HANDLE hrichedit = 0; @@ -4071,9 +4073,11 @@ /* GDI+ Needs to be initialized before calling _init_thread(); */ _init_thread(); + if((huxtheme = LoadLibrary(TEXT("uxtheme")))) + _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme"); #ifdef AEROGLASS /* Attempt to load the Desktop Window Manager and Theme library */ - if((hdwm = LoadLibrary(TEXT("dwmapi"))) && (huxtheme = LoadLibrary(TEXT("uxtheme")))) + if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi")))) { _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea"); if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled"))) @@ -4084,7 +4088,6 @@ _DrawThemeTextEx = (HRESULT (WINAPI *)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const DTTOPTS *))GetProcAddress(huxtheme, "DrawThemeTextEx"); _EndBufferedPaint = (HRESULT (WINAPI *)(HPAINTBUFFER, BOOL))GetProcAddress(huxtheme, "EndBufferedPaint"); _CloseThemeData = (HRESULT (WINAPI *)(HTHEME))GetProcAddress(huxtheme, "CloseThemeData"); - _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme"); } /* In case of error close the library if needed */ else if(hdwm) @@ -6255,11 +6258,9 @@ tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); -#ifdef AEROGLASS /* Disable visual styles by default */ if(_SetWindowTheme) _SetWindowTheme(tmp, TEXT(""), TEXT("")); -#endif /* Insert the single bitmap and button into the toolbar */ SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); @@ -7637,11 +7638,10 @@ { SetWindowLong(handle, GWL_STYLE, (style & DW_BS_NOBORDER) ? (currentstyle | thisstyle) : (currentstyle & ~thisstyle)); -#ifdef AEROGLASS /* Enable or disable visual themese */ if(_SetWindowTheme) _SetWindowTheme(handle, (style & DW_BS_NOBORDER) ? NULL : TEXT(""), (style & DW_BS_NOBORDER) ? NULL : TEXT("")); -#endif + return; } } @@ -11342,8 +11342,8 @@ #ifdef AEROGLASS /* Free any in use libraries */ FreeLibrary(hdwm); +#endif FreeLibrary(huxtheme); -#endif exit(exitcode); }