diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 13:01:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 13:01:22 (GMT) |
commit | 23168c6a007fbb6ce29be0d45d1f043528d207eb (patch) | |
tree | cf7ff7b2af8c50787a980b4fd8086134b46c7680 /win | |
parent | 4e443756225e0c9249ce210e9e23bb48e53aee68 (diff) | |
parent | d0f56684e57c15c590975be1a7f608b170a3ee40 (diff) | |
download | tk-23168c6a007fbb6ce29be0d45d1f043528d207eb.zip tk-23168c6a007fbb6ce29be0d45d1f043528d207eb.tar.gz tk-23168c6a007fbb6ce29be0d45d1f043528d207eb.tar.bz2 |
Merge 8.6
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinInt.h | 1 | ||||
-rw-r--r-- | win/tkWinMenu.c | 9 | ||||
-rw-r--r-- | win/tkWinX.c | 12 | ||||
-rw-r--r-- | win/ttkWinXPTheme.c | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/win/tkWinInt.h b/win/tkWinInt.h index c1b0658..7e3119e 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -185,6 +185,7 @@ MODULE_SCOPE void TkWinSetupSystemFonts(TkMainInfo *mainPtr); #define TK_THEME_WIN_CLASSIC 1 #define TK_THEME_WIN_XP 2 +#define TK_THEME_WIN_VISTA 3 /* * The following is implemented in tkWinWm and used by tkWinEmbed.c diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index ecccb94..1887f73 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1943,7 +1943,7 @@ DrawMenuEntryAccelerator( * Draw disabled 3D text highlight only with the Win95/98 look. */ - if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) { + if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) { if ((mePtr->state == ENTRY_DISABLED) && (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) { COLORREF oldFgColor = gc->foreground; @@ -2495,7 +2495,7 @@ DrawMenuEntryLabel( int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2; const char *label = Tcl_GetString(mePtr->labelPtr); - if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) { + if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) { /* * Win 95/98 systems draw disabled menu text with a 3D * highlight, unless the menu item is highlighted, @@ -3400,7 +3400,6 @@ SetDefaults( HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ NONCLIENTMETRICSW metrics; - OSVERSIONINFOW os; /* * Set all of the default options. The loop will terminate when we run out @@ -3420,9 +3419,7 @@ SetDefaults( metrics.cbSize = sizeof(metrics); - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - GetVersionExW(&os); - if (os.dwMajorVersion < 6) { + if (TkWinGetPlatformTheme() != TK_THEME_WIN_VISTA) { metrics.cbSize -= sizeof(int); } diff --git a/win/tkWinX.c b/win/tkWinX.c index c275120..34fabc9 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -326,6 +326,7 @@ TkWinXCleanup( * 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 + * TK_THEME_WIN_VISTA Vista or higher * *---------------------------------------------------------------------- */ @@ -339,13 +340,16 @@ TkWinGetPlatformTheme(void) os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); + 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.dwMajorVersion == 5 && os.dwMinorVersion == 1)) { + if ((os.dwMajorVersion == 5) && (os.dwMinorVersion == 1)) { HKEY hKey; LPCWSTR szSubKey = L"Control Panel\\Appearance"; LPCWSTR szCurrent = L"Current"; @@ -365,6 +369,8 @@ TkWinGetPlatformTheme(void) tkWinTheme = TK_THEME_WIN_XP; } } + } else if (os.dwMajorVersion > 5) { + tkWinTheme = TK_THEME_WIN_VISTA; } else { tkWinTheme = TK_THEME_WIN_CLASSIC; } diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 9803def..fec0450 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1285,10 +1285,6 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) HINSTANCE hlibrary; Ttk_Theme themePtr, parentPtr, vistaPtr; const ElementInfo *infoPtr; - OSVERSIONINFOW os; - - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - GetVersionExW(&os); procs = LoadXPThemeProcs(&hlibrary); if (!procs) @@ -1321,7 +1317,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) * enable function. The theme itself is defined in script. */ - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && os.dwMajorVersion > 5) { + if (TkWinGetPlatformTheme() == TK_THEME_WIN_VISTA) { vistaPtr = Ttk_CreateTheme(interp, "vista", themePtr); if (vistaPtr) { Ttk_SetThemeEnabledProc(vistaPtr, XPThemeEnabled, themeData); |