From 034000b68dc676b7404395f96c20564a923db4d5 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Wed, 19 Feb 2003 22:04:46 +0000 Subject: [PATCH] Convert Twips values from the registry. --- windows/sysmetrics.c | 2 +- windows/sysparams.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c index ee156f880e3..fe83e7dbc02 100644 --- a/windows/sysmetrics.c +++ b/windows/sysmetrics.c @@ -43,7 +43,7 @@ static int sysMetrics[SM_WINE_CMETRICS+1]; * MSDN Library - April 2001 -> Resource Kits -> * Windows 2000 Resource Kit Reference -> * Technical Reference to the Windows 2000 Registry -> - * HKEY_CURRENT_USE -> Control Panel -> Desktop -> WindowMetrics + * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics * * This is written as a function to prevent repeated evaluation of the * argument. diff --git a/windows/sysparams.c b/windows/sysparams.c index e64b91d6a0a..a1f94722006 100644 --- a/windows/sysparams.c +++ b/windows/sysparams.c @@ -510,6 +510,14 @@ static void SYSPARAMS_GetGUIFont( LOGFONTA* plf ) } } +/* copied from GetSystemMetrics()'s RegistryTwips2Pixels() */ +inline static int SYSPARAMS_Twips2Pixels(int x) +{ + if (x < 0) + x = (-x+7)/15; + return x; +} + /*********************************************************************** * SystemParametersInfoA (USER32.@) * @@ -531,6 +539,8 @@ static void SYSPARAMS_GetGUIFont( LOGFONTA* plf ) * registry branch if saving is requested. Otherwise it is stored * in temporary branch * + * Some SPI values can also be stored as Twips values in the registry, + * don't forget the conversion! */ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni ) @@ -635,12 +645,9 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, { char buf[10]; - if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, - buf )) - { - int i = atoi( buf ); - if (i > 0) border = i; - } + if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf )) + border = SYSPARAMS_Twips2Pixels( atoi(buf) ); + spi_loaded[spi_idx] = TRUE; if (TWEAK_WineLook > WIN31_LOOK) { @@ -723,11 +730,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, if (!spi_loaded[spi_idx]) { char buf[10]; + int val; if (SYSPARAMS_Load( SPI_ICONHORIZONTALSPACING_REGKEY, SPI_ICONHORIZONTALSPACING_VALNAME, buf )) { - SYSMETRICS_Set( SM_CXICONSPACING, atoi( buf ) ); + val = SYSPARAMS_Twips2Pixels( atoi(buf) ); + SYSMETRICS_Set( SM_CXICONSPACING, val ); } spi_loaded[spi_idx] = TRUE; } @@ -904,11 +913,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, if (!spi_loaded[spi_idx]) { char buf[10]; + int val; if (SYSPARAMS_Load( SPI_ICONVERTICALSPACING_REGKEY, SPI_ICONVERTICALSPACING_VALNAME, buf )) { - SYSMETRICS_Set( SM_CYICONSPACING, atoi( buf ) ); + val = SYSPARAMS_Twips2Pixels( atoi(buf) ); + SYSMETRICS_Set( SM_CYICONSPACING, val ); } spi_loaded[spi_idx] = TRUE; }