Version 3
Index: sysparams.c =================================================================== RCS file: /home/wine/wine/windows/sysparams.c,v retrieving revision 1.56 diff -u -b -r1.56 sysparams.c --- sysparams.c 31 Oct 2003 04:18:55 -0000 1.56 +++ sysparams.c 29 Nov 2003 17:24:14 -0000 @@ -148,6 +148,9 @@ static BOOL keyboard_pref = TRUE; static BOOL screen_reader = FALSE; static BOOL screensaver_running = FALSE; +static LOGFONTA iconTitleLogFont; +static INT nonClientMetrics_MenuFontHeight; +static CHAR nonClientMetrics_MenuFontFaceName[LF_FACESIZE]; /*********************************************************************** * GetTimerResolution (USER.14) @@ -1092,6 +1095,14 @@ if (!pvParam) return FALSE; + spi_idx = SPI_GETICONTITLELOGFONT; + + if (!spi_loaded[spi_idx]) + { + memcpy(lpLogFont, &iconTitleLogFont, sizeof(LOGFONTA)); + break; + } + /* * The 'default GDI fonts' seems to be returned. * If a returned font is not a correct font in your environment, @@ -1101,19 +1112,21 @@ GetProfileStringA( "Desktop", "IconTitleFaceName", lfDefault.lfFaceName, - lpLogFont->lfFaceName, LF_FACESIZE ); - lpLogFont->lfHeight = -GetProfileIntA( "Desktop", "IconTitleSize", 11 ); - lpLogFont->lfWidth = 0; - lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0; - lpLogFont->lfWeight = FW_NORMAL; - lpLogFont->lfItalic = FALSE; - lpLogFont->lfStrikeOut = FALSE; - lpLogFont->lfUnderline = FALSE; - lpLogFont->lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */ - lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS; - lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS; - lpLogFont->lfPitchAndFamily = DEFAULT_PITCH; - lpLogFont->lfQuality = DEFAULT_QUALITY; + iconTitleLogFont.lfFaceName, LF_FACESIZE ); + iconTitleLogFont.lfHeight = -GetProfileIntA( "Desktop", "IconTitleSize", 11 ); + iconTitleLogFont.lfWidth = 0; + iconTitleLogFont.lfEscapement = iconTitleLogFont.lfOrientation = 0; + iconTitleLogFont.lfWeight = FW_NORMAL; + iconTitleLogFont.lfItalic = FALSE; + iconTitleLogFont.lfStrikeOut = FALSE; + iconTitleLogFont.lfUnderline = FALSE; + iconTitleLogFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */ + iconTitleLogFont.lfOutPrecision = OUT_DEFAULT_PRECIS; + iconTitleLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + iconTitleLogFont.lfPitchAndFamily = DEFAULT_PITCH; + iconTitleLogFont.lfQuality = DEFAULT_QUALITY; + memcpy(lpLogFont, &iconTitleLogFont, sizeof(LOGFONTA)); + spi_loaded[spi_idx] = TRUE; break; } @@ -1209,9 +1222,10 @@ if (!pvParam) return FALSE; + spi_idx = SPI_GETNONCLIENTMETRICS; if (lpnm->cbSize == sizeof(NONCLIENTMETRICSA)) { - /* clear the struct, so we have 'sane' members */ + /* clear the supplied struct, so we have 'sane' members */ memset( (char *)pvParam + sizeof(lpnm->cbSize), 0, @@ -1246,10 +1260,17 @@ /* menu font metrics */ SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfMenuFont), 0 ); + + /* we only cache the Desktop/MenuFont stuff as everything else is backed by SystemMetrics */ + if (!spi_loaded[spi_idx]) { GetProfileStringA( "Desktop", "MenuFont", (TWEAK_WineLook > WIN31_LOOK) ? lpnm->lfCaptionFont.lfFaceName : "System", - lpnm->lfMenuFont.lfFaceName, LF_FACESIZE ); - lpnm->lfMenuFont.lfHeight = -GetProfileIntA( "Desktop", "MenuFontSize", 11 ); + nonClientMetrics_MenuFontFaceName, LF_FACESIZE ); + nonClientMetrics_MenuFontHeight = -GetProfileIntA( "Desktop", "MenuFontSize", 11 ); + spi_loaded[spi_idx] = TRUE; + } + memcpy(lpnm->lfMenuFont.lfFaceName, nonClientMetrics_MenuFontFaceName, LF_FACESIZE); + lpnm->lfMenuFont.lfHeight = nonClientMetrics_MenuFontHeight; lpnm->lfMenuFont.lfWeight = (TWEAK_WineLook > WIN31_LOOK) ? FW_NORMAL : FW_BOLD; /* status bar font metrics */ @@ -1258,6 +1279,8 @@ /* message font metrics */ SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfMessageFont), 0 ); + + spi_loaded[spi_idx] = TRUE; } else {