summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinMenu.c')
-rw-r--r--win/tkWinMenu.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 2ced640..6dd56d4 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -3189,7 +3189,14 @@ SetDefaults(
TEXTMETRICA tm;
int pointSize;
HFONT menuFont;
- NONCLIENTMETRICSA ncMetrics;
+ /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
+ struct {
+ NONCLIENTMETRICS metrics;
+#if (WINVER < 0x0600)
+ int padding;
+#endif
+ } nc;
+ OSVERSIONINFO os;
/*
* Set all of the default options. The loop will terminate when we run out
@@ -3207,10 +3214,17 @@ SetDefaults(
}
Tcl_DStringInit(&menuFontDString);
- ncMetrics.cbSize = sizeof(ncMetrics);
- SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics),
- &ncMetrics, 0);
- menuFont = CreateFontIndirectA(&ncMetrics.lfMenuFont);
+ nc.metrics.cbSize = sizeof(nc);
+
+ os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&os);
+ if (os.dwMajorVersion < 6) {
+ nc.metrics.cbSize -= sizeof(int);
+ }
+
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
+ &nc.metrics, 0);
+ menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
GetTextMetricsA(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);