From 3b8a1a19064c05bb314d93d5ce9e2d51efbb5e44 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 9 Nov 2016 13:41:27 +0000 Subject: Bring all win32 version stuff to one place. Should work the same (should still work on XP, although I don't know if we really want that). --- win/tkWin.h | 12 +++++++++--- win/tkWinMenu.c | 17 ++++++----------- win/tkWinX.c | 10 ---------- win/ttkWinXPTheme.c | 6 +----- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/win/tkWin.h b/win/tkWin.h index 4d278d7..86be2e9 100644 --- a/win/tkWin.h +++ b/win/tkWin.h @@ -18,14 +18,20 @@ * the SystemParametersInfo API doesn't like to receive structures that * are larger than it expects which affects the font assignments. * - * WINVER = 0x0500 means Windows 2000 and above + * NTDDI_VERSION = 0x0600 means Windows Vista and above */ +#ifndef NTDDI_VERSION +#define NTDDI_VERSION 0x06000000 +#endif #ifndef WINVER -#define WINVER 0x0500 +#define WINVER 0x0600 #endif #ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 +#define _WIN32_WINNT 0x0600 +#endif +#ifndef _WIN32_IE +#define _WIN32_IE 0x0600 #endif #ifndef _TK diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 8e14669..0975633 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -3203,12 +3203,7 @@ SetDefaults( int pointSize; HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ - struct { - NONCLIENTMETRICS metrics; -#if (WINVER < 0x0600) - int padding; -#endif - } nc; + NONCLIENTMETRICS metrics; OSVERSIONINFOW os; /* @@ -3227,17 +3222,17 @@ SetDefaults( } Tcl_DStringInit(&menuFontDString); - nc.metrics.cbSize = sizeof(nc); + metrics.cbSize = sizeof(metrics); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); if (os.dwMajorVersion < 6) { - nc.metrics.cbSize -= sizeof(int); + metrics.cbSize -= sizeof(int); } - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize, - &nc.metrics, 0); - menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, + &metrics, 0); + menuFont = CreateFontIndirect(&metrics.lfMenuFont); SelectObject(scratchDC, menuFont); GetTextMetricsA(scratchDC, &tm); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); diff --git a/win/tkWinX.c b/win/tkWinX.c index cfd64af..d41b6c1 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -13,16 +13,6 @@ #include "tkWinInt.h" -/* - * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE by - * default. Define it here to gain access to the InitCommonControlsEx API in - * commctrl.h. - */ - -#ifndef _WIN32_IE -#define _WIN32_IE 0x0550 /* IE 5.5 */ -#endif - #include #ifdef _MSC_VER # pragma comment (lib, "comctl32.lib") diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 3de1504..909660a 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -15,14 +15,12 @@ * shellcc/platform/commctls/userex/refentry.asp > */ +#include #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ -#include int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #else -#define WINVER 0x0501 /* Requires Windows XP APIs */ - #include #include #if defined(HAVE_VSSYM32_H) || _MSC_VER > 1500 @@ -31,8 +29,6 @@ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } # include #endif -#include - #include "ttk/ttkTheme.h" typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd, -- cgit v0.12