diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | win/tkWinMenu.c | 24 |
2 files changed, 25 insertions, 6 deletions
@@ -1,3 +1,8 @@ +2011-03-24 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tkWinMenu.c: [Bug #3239768] tk8.4.19 (and later) WIN32 + menu font support. + 2011-03-16 Jan Nijtmans <nijtmans@users.sf.net> * unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and @@ -50,7 +55,7 @@ 2011-01-22 Joe English <jenglish@users.sourceforge.net> - * generic/ttk/ttkEntry.c(ttk::combobox): Add missing + * generic/ttk/ttkEntry.c(ttk::combobox): Add missing 'validate' command (reported by schelte). 2011-01-13 Jan Nijtmans <nijtmans@users.sf.net> 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); |