diff options
author | jenglish@flightlab.com <jenglish> | 2007-04-10 18:14:24 (GMT) |
---|---|---|
committer | jenglish@flightlab.com <jenglish> | 2007-04-10 18:14:24 (GMT) |
commit | 5c92eeae963d9367d7abc04a7c1885040b9fb05a (patch) | |
tree | 6cbb64dd22d025e8ed46d33f6d6c96dadd07b8cd /win/ttkWinXPTheme.c | |
parent | 33d32b87b02d1f194503f165daa0996f497085dc (diff) | |
download | tk-5c92eeae963d9367d7abc04a7c1885040b9fb05a.zip tk-5c92eeae963d9367d7abc04a7c1885040b9fb05a.tar.gz tk-5c92eeae963d9367d7abc04a7c1885040b9fb05a.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].
Diffstat (limited to 'win/ttkWinXPTheme.c')
-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; } |