diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 08:50:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 08:50:15 (GMT) |
commit | 14f8dd18221e49047e35cab7dd25fc1a8b3d0e18 (patch) | |
tree | a7b7fc6c0cef28b709eeb8627d1cc76f8eb8dbd2 /win | |
parent | 5ba1f53457e736aca5c53ac1ff82a69aa27f46b1 (diff) | |
parent | 3b78f220c64621efbcf961ead516817da2a5d73f (diff) | |
download | tk-14f8dd18221e49047e35cab7dd25fc1a8b3d0e18.zip tk-14f8dd18221e49047e35cab7dd25fc1a8b3d0e18.tar.gz tk-14f8dd18221e49047e35cab7dd25fc1a8b3d0e18.tar.bz2 |
[Bug #3239768] tk8.4.19 (and later) WIN32 menu font support.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinMenu.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 5cd4b3f..6c8210d 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -973,7 +973,7 @@ TkWinEmbeddedMenuProc( break; case WM_SETTINGCHANGE: - if (wParam == SPI_SETNONCLIENTMETRICS + if (wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETKEYBOARDCUES) { SetDefaults(0); } @@ -2624,7 +2624,7 @@ TkpDrawMenuEntry( fmPtr, adjustedX, adjustedY, width, adjustedHeight); } } - + /* * Copy the entry contents from the temporary bitmap to the menu. */ @@ -3194,7 +3194,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 out @@ -3212,10 +3219,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); |