From edb852308c52be27554a75d9d7ada7276e13bfb2 Mon Sep 17 00:00:00 2001 From: Byeongsik Jeon Date: Sat, 27 Dec 2008 17:56:49 +0900 Subject: [PATCH] user32: Implementation the SPI_{GET|SET}FONTSMOOTHING* actions. --- dlls/user32/sysparams.c | 111 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 7 deletions(-) diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index bd1b36c6a8a..92dc912eab5 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -86,6 +86,9 @@ enum spi_index SPI_SETFOREGROUNDLOCKTIMEOUT_IDX, SPI_CARETWIDTH_IDX, SPI_SETMOUSESPEED_IDX, + SPI_SETFONTSMOOTHINGTYPE_IDX, + SPI_SETFONTSMOOTHINGCONTRAST_IDX, + SPI_SETFONTSMOOTHINGORIENTATION_IDX, SPI_INDEX_COUNT }; @@ -224,6 +227,12 @@ static const WCHAR SPI_CARETWIDTH_REGKEY[]= {'C','o','n','t',' static const WCHAR SPI_CARETWIDTH_VALNAME[]= {'C','a','r','e','t','W','i','d','t','h',0}; static const WCHAR SPI_SETMOUSESPEED_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0}; static const WCHAR SPI_SETMOUSESPEED_VALNAME[]= {'M','o','u','s','e','S','e','n','s','i','t','i','v','i','t','y',0}; +static const WCHAR SPI_SETFONTSMOOTHINGTYPE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0}; +static const WCHAR SPI_SETFONTSMOOTHINGTYPE_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0}; +static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0}; +static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','G','a','m','m','a',0}; +static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0}; +static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','O','r','i','e','n','t','a','t','i','o','n',0}; /* FIXME - real values */ static const WCHAR SPI_SETSCREENSAVERRUNNING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0}; @@ -316,6 +325,9 @@ static BOOL swap_buttons = FALSE; static UINT foreground_lock_timeout = 0; static UINT caret_width = 1; static UINT mouse_sensitivity = 10; +static UINT font_smoothing_type = 0; +static UINT font_smoothing_contrast = 0; +static UINT font_smoothing_orientation = 0; static BYTE user_prefs[4]; static MINIMIZEDMETRICS minimized_metrics = @@ -1986,7 +1998,10 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, SPI_SETFONTSMOOTHING_REGKEY, SPI_SETFONTSMOOTHING_VALNAME, &font_smoothing, &tmpval ); - *(UINT *) pvParam = ( tmpval != 0); + if (!pvParam) ret = FALSE; + + if (ret) + *(UINT *) pvParam = ( tmpval != 0); break; } case SPI_SETFONTSMOOTHING: @@ -2357,16 +2372,98 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ - WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ - WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ - WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */ - WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */ + case SPI_GETFONTSMOOTHINGTYPE: /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ + spi_idx = SPI_SETFONTSMOOTHINGTYPE_IDX; + if (!spi_loaded[spi_idx]) + { + ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGTYPE_REGKEY, + SPI_SETFONTSMOOTHINGTYPE_VALNAME, + (LPWSTR)&font_smoothing_type, + sizeof(font_smoothing_type) ); + if ( ret) spi_loaded[spi_idx] = TRUE; + } + if (!pvParam) ret = FALSE; + + if (ret) + *(UINT *)pvParam = font_smoothing_type; + break; + + case SPI_SETFONTSMOOTHINGTYPE: /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */ + spi_idx = SPI_SETFONTSMOOTHINGTYPE_IDX; + if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGTYPE_REGKEY, + SPI_SETFONTSMOOTHINGTYPE_VALNAME, + (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni )) + { + font_smoothing_type = (UINT)pvParam; + spi_loaded[spi_idx] = TRUE; + } + else + ret = FALSE; + break; + + case SPI_GETFONTSMOOTHINGCONTRAST: /* 0x200C _WIN32_WINNT >= 0x510 */ + spi_idx = SPI_SETFONTSMOOTHINGCONTRAST_IDX; + if (!spi_loaded[spi_idx]) + { + ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY, + SPI_SETFONTSMOOTHINGCONTRAST_VALNAME, + (LPWSTR)&font_smoothing_contrast, + sizeof(font_smoothing_contrast) ); + if (ret) + spi_loaded[spi_idx] = TRUE; + } + if (!pvParam) ret = FALSE; + + if (ret) + *(UINT *)pvParam = font_smoothing_contrast; + break; + + case SPI_SETFONTSMOOTHINGCONTRAST: /* 0x200D _WIN32_WINNT >= 0x510 */ + spi_idx = SPI_SETFONTSMOOTHINGCONTRAST_IDX; + if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY, + SPI_SETFONTSMOOTHINGCONTRAST_VALNAME, + (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni )) + { + font_smoothing_contrast = (UINT)pvParam; + spi_loaded[spi_idx] = TRUE; + } + else + ret = FALSE; + break; + WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */ WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */ WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */ WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */ - WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGORIENTATION); /* 0x2012 */ - WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGORIENTATION); /* 0x2013 */ + case SPI_GETFONTSMOOTHINGORIENTATION: /* 0x2012 */ + spi_idx = SPI_SETFONTSMOOTHINGORIENTATION_IDX; + if (!spi_loaded[spi_idx]) + { + ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY, + SPI_SETFONTSMOOTHINGORIENTATION_VALNAME, + (LPWSTR)&font_smoothing_orientation, + sizeof(font_smoothing_orientation) ); + if (ret) + spi_loaded[spi_idx] = TRUE; + } + if (!pvParam) ret = FALSE; + + if (ret) + *(UINT *)pvParam = font_smoothing_orientation; + break; + + case SPI_SETFONTSMOOTHINGORIENTATION: /* 0x2013 */ + spi_idx = SPI_SETFONTSMOOTHINGORIENTATION_IDX; + if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY, + SPI_SETFONTSMOOTHINGORIENTATION_VALNAME, + (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni )) + { + font_smoothing_orientation = (UINT)pvParam; + spi_loaded[spi_idx] = TRUE; + } + else + ret = FALSE; + break; default: FIXME( "Unknown action: %u\n", uiAction );