summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-03-24 09:00:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-03-24 09:00:13 (GMT)
commit2d43f302babfefbdcacdd9855d22ca66f64978bc (patch)
tree5acee400ee1f7acb934372459477b1b64eb95fd0 /win
parenta11d2888f9486a0d049373fb81beebe3f438f93f (diff)
parent14f8dd18221e49047e35cab7dd25fc1a8b3d0e18 (diff)
downloadtk-2d43f302babfefbdcacdd9855d22ca66f64978bc.zip
tk-2d43f302babfefbdcacdd9855d22ca66f64978bc.tar.gz
tk-2d43f302babfefbdcacdd9855d22ca66f64978bc.tar.bz2
[Bug #3239768] tk8.4.19 (and later) WIN32 menu font support.
Diffstat (limited to 'win')
-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);