diff options
author | jenglish <jenglish@noemail.net> | 2007-04-10 18:14:23 (GMT) |
---|---|---|
committer | jenglish <jenglish@noemail.net> | 2007-04-10 18:14:23 (GMT) |
commit | 9fd3736a7f61a23c966494dfffc33645fd368f3a (patch) | |
tree | 6cbb64dd22d025e8ed46d33f6d6c96dadd07b8cd /win | |
parent | 1f84f7e4ea2411f31b3b5d82c9919d347c0f0127 (diff) | |
download | tk-9fd3736a7f61a23c966494dfffc33645fd368f3a.zip tk-9fd3736a7f61a23c966494dfffc33645fd368f3a.tar.gz tk-9fd3736a7f61a23c966494dfffc33645fd368f3a.tar.bz2 |
Skip OS version test, should work on Vista/Aero now as well as XP
[Fixes #1687299, thanks to George Petasis for tracking this down].
FossilOrigin-Name: dd94dd3b164ff02d4f7043b74d90fcc219821ee8
Diffstat (limited to 'win')
-rw-r--r-- | win/ttkWinXPTheme.c | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 6e4ebe9..c10e964 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.10 2007/04/10 18:05:48 jenglish Exp $ + * $Id: ttkWinXPTheme.c,v 1.11 2007/04/10 18:14:24 jenglish Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -90,50 +90,37 @@ typedef struct static XPThemeProcs * LoadXPThemeProcs(HINSTANCE *phlib) { - OSVERSIONINFO os; - /* - * We have to check whether we are running at least on Windows XP. - * In order to determine this we call GetVersionEx directly, although - * it would be a good idea to wrap it inside a function similar to - * TkWinGetPlatformId... + * Load the library "uxtheme.dll", where the native widget + * drawing routines are implemented. This will only succeed + * if we are running at least on Windows XP. */ - ZeroMemory(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os); - if (os.dwMajorVersion >= 5 && os.dwMinorVersion >= 1) { + HINSTANCE handle; + *phlib = handle = LoadLibrary("uxtheme.dll"); + if (handle != 0) + { /* - * We are running under Windows XP or a newer version. - * Load the library "uxtheme.dll", where the native widget - * drawing routines are implemented. + * We have successfully loaded the library. Proceed in storing the + * addresses of the functions we want to use. */ - HINSTANCE handle; - *phlib = handle = LoadLibrary("uxtheme.dll"); - if (handle != 0) - { - /* - * We have successfully loaded the library. Proceed in storing the - * addresses of the functions we want to use. - */ - XPThemeProcs *procs = (XPThemeProcs*)ckalloc(sizeof(XPThemeProcs)); + XPThemeProcs *procs = (XPThemeProcs*)ckalloc(sizeof(XPThemeProcs)); #define LOADPROC(name) \ (0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) )) - if ( LOADPROC(OpenThemeData) - && LOADPROC(CloseThemeData) - && LOADPROC(GetThemePartSize) - && LOADPROC(DrawThemeBackground) - && LOADPROC(GetThemeTextExtent) - && LOADPROC(DrawThemeText) - && LOADPROC(IsThemeActive) - && LOADPROC(IsAppThemed) - ) - { - return procs; - } -#undef LOADPROC - ckfree((char*)procs); + if ( LOADPROC(OpenThemeData) + && LOADPROC(CloseThemeData) + && LOADPROC(GetThemePartSize) + && LOADPROC(DrawThemeBackground) + && LOADPROC(GetThemeTextExtent) + && LOADPROC(DrawThemeText) + && LOADPROC(IsThemeActive) + && LOADPROC(IsAppThemed) + ) + { + return procs; } +#undef LOADPROC + ckfree((char*)procs); } return 0; } |