diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 08:11:32 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 08:11:32 (GMT) |
commit | 3b78f220c64621efbcf961ead516817da2a5d73f (patch) | |
tree | 3c736341cf2f9a7445ab3c299427605a7e2a410e /win | |
parent | 30be6c1a93c62e6cac369d88b720615a147982d1 (diff) | |
download | tk-3b78f220c64621efbcf961ead516817da2a5d73f.zip tk-3b78f220c64621efbcf961ead516817da2a5d73f.tar.gz tk-3b78f220c64621efbcf961ead516817da2a5d73f.tar.bz2 |
[Bug #3239768] tk8.4.19 (and later) WIN32 menu font support
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinMenu.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 744869f..a49742f 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -2485,7 +2485,7 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr) * portion */ { TkMenu *menuPtr = mePtr->menuPtr; - int haveImage = 0, haveText = 0; + int haveImage = 0; if (mePtr->image != NULL) { Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr); @@ -2972,7 +2972,14 @@ SetDefaults( TEXTMETRIC tm; int pointSize; HFONT menuFont; - NONCLIENTMETRICS 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 @@ -2990,10 +2997,17 @@ SetDefaults( } Tcl_DStringInit(&menuFontDString); - ncMetrics.cbSize = sizeof(ncMetrics); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics), - &ncMetrics, 0); - menuFont = CreateFontIndirect(&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); GetTextMetrics(scratchDC, &tm); GetTextFace(scratchDC, LF_FACESIZE, faceName); |