Commit 034000b6 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Convert Twips values from the registry.

parent 6356a441
...@@ -43,7 +43,7 @@ static int sysMetrics[SM_WINE_CMETRICS+1]; ...@@ -43,7 +43,7 @@ static int sysMetrics[SM_WINE_CMETRICS+1];
* MSDN Library - April 2001 -> Resource Kits -> * MSDN Library - April 2001 -> Resource Kits ->
* Windows 2000 Resource Kit Reference -> * Windows 2000 Resource Kit Reference ->
* Technical Reference to the Windows 2000 Registry -> * 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 * This is written as a function to prevent repeated evaluation of the
* argument. * argument.
......
...@@ -510,6 +510,14 @@ static void SYSPARAMS_GetGUIFont( LOGFONTA* plf ) ...@@ -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.@) * SystemParametersInfoA (USER32.@)
* *
...@@ -531,6 +539,8 @@ static void SYSPARAMS_GetGUIFont( LOGFONTA* plf ) ...@@ -531,6 +539,8 @@ static void SYSPARAMS_GetGUIFont( LOGFONTA* plf )
* registry branch if saving is requested. Otherwise it is stored * registry branch if saving is requested. Otherwise it is stored
* in temporary branch * 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, BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
PVOID pvParam, UINT fWinIni ) PVOID pvParam, UINT fWinIni )
...@@ -635,12 +645,9 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, ...@@ -635,12 +645,9 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
{ {
char buf[10]; char buf[10];
if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf ))
buf )) border = SYSPARAMS_Twips2Pixels( atoi(buf) );
{
int i = atoi( buf );
if (i > 0) border = i;
}
spi_loaded[spi_idx] = TRUE; spi_loaded[spi_idx] = TRUE;
if (TWEAK_WineLook > WIN31_LOOK) if (TWEAK_WineLook > WIN31_LOOK)
{ {
...@@ -723,11 +730,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, ...@@ -723,11 +730,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
if (!spi_loaded[spi_idx]) if (!spi_loaded[spi_idx])
{ {
char buf[10]; char buf[10];
int val;
if (SYSPARAMS_Load( SPI_ICONHORIZONTALSPACING_REGKEY, if (SYSPARAMS_Load( SPI_ICONHORIZONTALSPACING_REGKEY,
SPI_ICONHORIZONTALSPACING_VALNAME, buf )) 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; spi_loaded[spi_idx] = TRUE;
} }
...@@ -904,11 +913,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, ...@@ -904,11 +913,13 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
if (!spi_loaded[spi_idx]) if (!spi_loaded[spi_idx])
{ {
char buf[10]; char buf[10];
int val;
if (SYSPARAMS_Load( SPI_ICONVERTICALSPACING_REGKEY, if (SYSPARAMS_Load( SPI_ICONVERTICALSPACING_REGKEY,
SPI_ICONVERTICALSPACING_VALNAME, buf )) 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; spi_loaded[spi_idx] = TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment