diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 12:53:21 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 12:53:21 (GMT) |
commit | d0f56684e57c15c590975be1a7f608b170a3ee40 (patch) | |
tree | c675e961c86f200609fcc46dca9b26867ded81bf /win/tkWinX.c | |
parent | e4aba9d0cdd24b1e25108d18d4a41e2d8e44c2bd (diff) | |
download | tk-d0f56684e57c15c590975be1a7f608b170a3ee40.zip tk-d0f56684e57c15c590975be1a7f608b170a3ee40.tar.gz tk-d0f56684e57c15c590975be1a7f608b170a3ee40.tar.bz2 |
Split (internal) TK_THEME_WIN_CLASSIC into two different symbols: TK_THEME_WIN_CLASSIC/TK_THEME_WIN_VISTA
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r-- | win/tkWinX.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c index 6055bfc..689268d 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -70,7 +70,6 @@ static const char winScreenName[] = ":0"; /* Default name of windows display. */ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ static int childClassInitialized; /* Registered child class? */ static WNDCLASSW childClass; /* Window class for child windows. */ -static int tkPlatformId = 0; /* version of Windows platform */ static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */ static Tcl_Encoding keyInputEncoding = NULL; /* The current character encoding for @@ -328,42 +327,38 @@ TkWinXCleanup( /* *---------------------------------------------------------------------- * - * TkWinGetPlatformId -- + * TkWinGetPlatformTheme -- * - * Determines whether running under NT, 95, or Win32s, to allow runtime - * conditional code. Win32s is no longer supported. + * Return the Windows drawing style we should be using. * * Results: * The return value is one of: - * VER_PLATFORM_WIN32s Win32s on Windows 3.1 (not supported) - * VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95, 98, ME (not supported) - * VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8 - * VER_PLATFORM_WIN32_CE Win32 on Windows CE - * - * Side effects: - * None. + * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode + * TK_THEME_WIN_XP XP not in classic mode + * TK_THEME_WIN_VISTA Vista or higher * *---------------------------------------------------------------------- */ int -TkWinGetPlatformId(void) +TkWinGetPlatformTheme(void) { - if (tkPlatformId == 0) { + if (tkWinTheme == 0) { OSVERSIONINFOW os; os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); - tkPlatformId = os.dwPlatformId; + + if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) { + Tcl_Panic("Windows NT is the only supported platform"); + } /* - * Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC. The + * Set tkWinTheme to be TK_THEME_WIN_(CLASSIC|XP|VISTA). The * TK_THEME_WIN_CLASSIC could be set even when running under XP if the * windows classic theme was selected. */ - - if ((os.dwPlatformId == VER_PLATFORM_WIN32_NT) && - (os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) { + if (os.dwMajorVersion == 5 && os.dwMinorVersion == 1) { HKEY hKey; LPCWSTR szSubKey = L"Control Panel\\Appearance"; LPCWSTR szCurrent = L"Current"; @@ -383,40 +378,39 @@ TkWinGetPlatformId(void) tkWinTheme = TK_THEME_WIN_XP; } } + } else if (os.dwMajorVersion > 5) { + tkWinTheme = TK_THEME_WIN_VISTA; } else { tkWinTheme = TK_THEME_WIN_CLASSIC; } } - return tkPlatformId; + return tkWinTheme; } /* *---------------------------------------------------------------------- * - * TkWinGetPlatformTheme -- + * TkWinGetPlatformId -- * - * Return the Windows drawing style we should be using. + * Determines whether running under NT, 95, or Win32s, to allow runtime + * conditional code. Win32s is no longer supported. * * Results: - * The return value is one of: - * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode - * TK_THEME_WIN_XP XP not in classic mode + * The return value is always: + * VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8 * * Side effects: - * Could invoke TkWinGetPlatformId. + * None. * *---------------------------------------------------------------------- */ int -TkWinGetPlatformTheme(void) +TkWinGetPlatformId(void) { - if (tkPlatformId == 0) { - TkWinGetPlatformId(); - } - return tkWinTheme; + return VER_PLATFORM_WIN32_NT; } - + /* *---------------------------------------------------------------------- * |