Commit 105450db authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

user: Read/save minimized metrics from/to registry.

parent 0577113e
...@@ -76,6 +76,7 @@ enum spi_index ...@@ -76,6 +76,7 @@ enum spi_index
SPI_SETPOWEROFFACTIVE_IDX, SPI_SETPOWEROFFACTIVE_IDX,
SPI_USERPREFERENCEMASK_IDX, SPI_USERPREFERENCEMASK_IDX,
SPI_NONCLIENTMETRICS_IDX, SPI_NONCLIENTMETRICS_IDX,
SPI_MINIMIZEDMETRICS_IDX,
SPI_INDEX_COUNT SPI_INDEX_COUNT
}; };
...@@ -228,6 +229,11 @@ static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t',' ...@@ -228,6 +229,11 @@ static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','
static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0}; static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0}; static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0}; static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
/* minimized metrics */
static const WCHAR METRICS_MINWIDTH_VALNAME[] = {'M','i','n','W','i','d','t','h','\0'};
static const WCHAR METRICS_MINHORZGAP_VALNAME[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
static const WCHAR METRICS_MINVERTGAP_VALNAME[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
static const WCHAR METRICS_MINARRANGE_VALNAME[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\', static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
'W','i','n','e',0}; 'W','i','n','e',0};
...@@ -789,6 +795,27 @@ static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR r ...@@ -789,6 +795,27 @@ static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR r
return TRUE; return TRUE;
} }
/* save an int parameter in registry */
static BOOL save_int_param( LPCWSTR regkey, LPCWSTR value, INT *value_ptr,
INT new_val, UINT fWinIni )
{
WCHAR buf[10];
wsprintfW(buf, CSd, new_val);
if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
*value_ptr = new_val;
return TRUE;
}
/* set an int parameter in the registry */
static inline BOOL set_int_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
INT *value_ptr, INT new_val, UINT fWinIni )
{
BOOL ret = save_int_param( regkey, value, value_ptr, new_val, fWinIni );
if (ret) spi_loaded[idx] = TRUE;
return ret;
}
/* set a uint parameter in the registry */ /* set a uint parameter in the registry */
static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value, static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
UINT *value_ptr, UINT new_val, UINT fWinIni ) UINT *value_ptr, UINT new_val, UINT fWinIni )
...@@ -945,6 +972,26 @@ static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf) ...@@ -945,6 +972,26 @@ static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
return found; return found;
} }
/* load all the minimized metrics */
static void load_minimized_metrics(void)
{
HKEY hkey;
if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
minimized_metrics.iWidth = max( get_reg_metric(hkey,
METRICS_MINWIDTH_VALNAME, minimized_metrics.iWidth), 0);
minimized_metrics.iHorzGap = max( get_reg_metric(hkey,
METRICS_MINHORZGAP_VALNAME, minimized_metrics.iHorzGap), 0);
minimized_metrics.iVertGap = max( get_reg_metric(hkey,
METRICS_MINVERTGAP_VALNAME, minimized_metrics.iVertGap), 0);
minimized_metrics.iArrange = 0x0f & get_reg_metric(hkey,
METRICS_MINARRANGE_VALNAME, minimized_metrics.iArrange);
if (hkey) RegCloseKey( hkey );
spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
}
/* load all the non-client metrics */ /* load all the non-client metrics */
static void load_nonclient_metrics(void) static void load_nonclient_metrics(void)
{ {
...@@ -1126,31 +1173,15 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1126,31 +1173,15 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_SETMOUSE: /* 4 */ case SPI_SETMOUSE: /* 4 */
{ {
WCHAR buf[10];
if (!pvParam) return FALSE; if (!pvParam) return FALSE;
ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
spi_idx = SPI_SETMOUSE_IDX; &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
wsprintfW(buf, CSd, ((INT *)pvParam)[0]); if( ret) {
save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
if (SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1, &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
buf, fWinIni )) save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
{ &mouse_speed, ((INT *)pvParam)[2], fWinIni);
mouse_threshold1 = ((INT *)pvParam)[0];
spi_loaded[spi_idx] = TRUE;
wsprintfW(buf, CSd, ((INT *)pvParam)[1]);
SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
buf, fWinIni );
mouse_threshold2 = ((INT *)pvParam)[1];
wsprintfW(buf, CSd, ((INT *)pvParam)[2]);
SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
buf, fWinIni );
mouse_speed = ((INT *)pvParam)[2];
} }
else
ret = FALSE;
break; break;
} }
...@@ -1479,9 +1510,10 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1479,9 +1510,10 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_GETMINIMIZEDMETRICS: case SPI_GETMINIMIZEDMETRICS:
{ {
MINIMIZEDMETRICS * lpMm = pvParam; MINIMIZEDMETRICS * lpMm = pvParam;
if (lpMm && lpMm->cbSize == sizeof(*lpMm)) if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) ); memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) );
else } else
ret = FALSE; ret = FALSE;
break; break;
} }
...@@ -1489,9 +1521,20 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1489,9 +1521,20 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_SETMINIMIZEDMETRICS: case SPI_SETMINIMIZEDMETRICS:
{ {
MINIMIZEDMETRICS * lpMm = pvParam; MINIMIZEDMETRICS * lpMm = pvParam;
if (lpMm && lpMm->cbSize == sizeof(*lpMm)) if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
memcpy( &minimized_metrics, lpMm, sizeof(*lpMm) ); ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
else &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
if( ret) ret = save_int_param( METRICS_REGKEY,
METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
max( lpMm->iHorzGap, 0), fWinIni);
if( ret) ret = save_int_param( METRICS_REGKEY,
METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
max( lpMm->iVertGap, 0), fWinIni);
if( ret) ret = save_int_param( METRICS_REGKEY,
METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
0x0f & lpMm->iArrange, fWinIni);
if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
} else
ret = FALSE; ret = FALSE;
break; break;
} }
...@@ -1521,20 +1564,24 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1521,20 +1564,24 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{ {
LPICONMETRICSW lpIcon = pvParam; LPICONMETRICSW lpIcon = pvParam;
if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) { if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX, ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
SPI_ICONVERTICALSPACING_REGKEY, SPI_ICONVERTICALSPACING_REGKEY,
SPI_ICONVERTICALSPACING_VALNAME, SPI_ICONVERTICALSPACING_VALNAME,
(UINT*)&icon_metrics.iVertSpacing, &icon_metrics.iVertSpacing,
lpIcon->iVertSpacing, fWinIni); lpIcon->iVertSpacing, fWinIni);
if( ret) ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX, if( ret) {
SPI_ICONHORIZONTALSPACING_REGKEY, ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
SPI_ICONHORIZONTALSPACING_VALNAME, SPI_ICONHORIZONTALSPACING_REGKEY,
(UINT*)&icon_metrics.iHorzSpacing, SPI_ICONHORIZONTALSPACING_VALNAME,
lpIcon->iHorzSpacing, fWinIni ); &icon_metrics.iHorzSpacing,
if( ret) ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX, lpIcon->iHorzSpacing, fWinIni );
}
if( ret) {
ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2, SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap, SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
lpIcon->iTitleWrap, fWinIni ); lpIcon->iTitleWrap, fWinIni );
}
if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY, if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni); SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
if( ret) { if( ret) {
...@@ -2467,8 +2514,10 @@ INT WINAPI GetSystemMetrics( INT index ) ...@@ -2467,8 +2514,10 @@ INT WINAPI GetSystemMetrics( INT index )
case SM_CYEDGE: case SM_CYEDGE:
return GetSystemMetrics(SM_CYBORDER) + 1; return GetSystemMetrics(SM_CYBORDER) + 1;
case SM_CXMINSPACING: case SM_CXMINSPACING:
if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap; return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
case SM_CYMINSPACING: case SM_CYMINSPACING:
if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap; return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
case SM_CXSMICON: case SM_CXSMICON:
case SM_CYSMICON: case SM_CYSMICON:
...@@ -2488,8 +2537,10 @@ INT WINAPI GetSystemMetrics( INT index ) ...@@ -2488,8 +2537,10 @@ INT WINAPI GetSystemMetrics( INT index )
if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics(); if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
return nonclient_metrics.iMenuHeight; return nonclient_metrics.iMenuHeight;
case SM_ARRANGE: case SM_ARRANGE:
if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
return minimized_metrics.iArrange; return minimized_metrics.iArrange;
case SM_CXMINIMIZED: case SM_CXMINIMIZED:
if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
return minimized_metrics.iWidth + 6; return minimized_metrics.iWidth + 6;
case SM_CYMINIMIZED: case SM_CYMINIMIZED:
if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics(); if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
......
...@@ -60,6 +60,11 @@ static int dpi; ...@@ -60,6 +60,11 @@ static int dpi;
#define SPI_ICONVERTICALSPACING_REGKEY "Control Panel\\Desktop\\WindowMetrics" #define SPI_ICONVERTICALSPACING_REGKEY "Control Panel\\Desktop\\WindowMetrics"
#define SPI_ICONVERTICALSPACING_REGKEY2 "Control Panel\\Desktop" #define SPI_ICONVERTICALSPACING_REGKEY2 "Control Panel\\Desktop"
#define SPI_ICONVERTICALSPACING_VALNAME "IconVerticalSpacing" #define SPI_ICONVERTICALSPACING_VALNAME "IconVerticalSpacing"
#define SPI_MINIMIZEDMETRICS_REGKEY "Control Panel\\Desktop\\WindowMetrics"
#define SPI_MINWIDTH_VALNAME "MinWidth"
#define SPI_MINHORZGAP_VALNAME "MinHorzGap"
#define SPI_MINVERTGAP_VALNAME "MinVertGap"
#define SPI_MINARRANGE_VALNAME "MinArrange"
#define SPI_SETSCREENSAVETIMEOUT_REGKEY "Control Panel\\Desktop" #define SPI_SETSCREENSAVETIMEOUT_REGKEY "Control Panel\\Desktop"
#define SPI_SETSCREENSAVETIMEOUT_VALNAME "ScreenSaveTimeOut" #define SPI_SETSCREENSAVETIMEOUT_VALNAME "ScreenSaveTimeOut"
#define SPI_SETSCREENSAVEACTIVE_REGKEY "Control Panel\\Desktop" #define SPI_SETSCREENSAVEACTIVE_REGKEY "Control Panel\\Desktop"
...@@ -910,15 +915,19 @@ static void test_SPI_SETICONTITLEWRAP( void ) /* 26 */ ...@@ -910,15 +915,19 @@ static void test_SPI_SETICONTITLEWRAP( void ) /* 26 */
for (i=0;i<sizeof(vals)/sizeof(*vals);i++) for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
{ {
UINT v; UINT v;
UINT regval;
rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, vals[i], 0, rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, vals[i], 0,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError()); ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
test_change_message( SPI_SETICONTITLEWRAP, 1 ); test_change_message( SPI_SETICONTITLEWRAP, 1 );
test_reg_key_ex( SPI_SETICONTITLEWRAP_REGKEY1, regval = metricfromreg( SPI_SETICONTITLEWRAP_REGKEY2,
SPI_SETICONTITLEWRAP_REGKEY2, SPI_SETICONTITLEWRAP_VALNAME, dpi);
SPI_SETICONTITLEWRAP_VALNAME, if( regval != vals[i])
vals[i] ? "1" : "0" ); regval = metricfromreg( SPI_SETICONTITLEWRAP_REGKEY1,
SPI_SETICONTITLEWRAP_VALNAME, dpi);
ok( regval == vals[i],
"wrong value in registry %d, expected %d\n", regval, vals[i] );
rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &v, 0 ); rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &v, 0 );
ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError()); ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
...@@ -1186,6 +1195,7 @@ static void test_SPI_SETDRAGFULLWINDOWS( void ) /* 37 */ ...@@ -1186,6 +1195,7 @@ static void test_SPI_SETDRAGFULLWINDOWS( void ) /* 37 */
static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
{ {
BOOL rc; BOOL rc;
INT regval;
MINIMIZEDMETRICS lpMm_orig; MINIMIZEDMETRICS lpMm_orig;
MINIMIZEDMETRICS lpMm_new; MINIMIZEDMETRICS lpMm_new;
MINIMIZEDMETRICS lpMm_cur; MINIMIZEDMETRICS lpMm_cur;
...@@ -1199,23 +1209,49 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */ ...@@ -1199,23 +1209,49 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_orig, FALSE ); rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_orig, FALSE );
if (!test_error_msg(rc,"SPI_{GET,SET}MINIMIZEDMETRICS")) if (!test_error_msg(rc,"SPI_{GET,SET}MINIMIZEDMETRICS"))
return; return;
/* test registry */
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINWIDTH_VALNAME, dpi);
ok( regval == lpMm_orig.iWidth, "wrong value in registry %d, expected %d\n",
regval, lpMm_orig.iWidth);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINHORZGAP_VALNAME, dpi);
ok( regval == lpMm_orig.iHorzGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_orig.iHorzGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINVERTGAP_VALNAME, dpi);
ok( regval == lpMm_orig.iVertGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_orig.iVertGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINARRANGE_VALNAME, dpi);
ok( regval == lpMm_orig.iArrange, "wrong value in registry %d, expected %d\n",
regval, lpMm_orig.iArrange);
/* set some new values */
lpMm_cur.iWidth = 180; lpMm_cur.iWidth = 180;
lpMm_cur.iHorzGap = 1; lpMm_cur.iHorzGap = 1;
lpMm_cur.iVertGap = 1; lpMm_cur.iVertGap = 1;
lpMm_cur.iArrange = 5; lpMm_cur.iArrange = 5;
rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_cur, FALSE ); &lpMm_cur, SPIF_UPDATEINIFILE );
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
/* read them back */
rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE ); rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
/* and compare */
eq( lpMm_new.iWidth, lpMm_cur.iWidth, "iWidth", "%d" ); eq( lpMm_new.iWidth, lpMm_cur.iWidth, "iWidth", "%d" );
eq( lpMm_new.iHorzGap, lpMm_cur.iHorzGap, "iHorzGap", "%d" ); eq( lpMm_new.iHorzGap, lpMm_cur.iHorzGap, "iHorzGap", "%d" );
eq( lpMm_new.iVertGap, lpMm_cur.iVertGap, "iVertGap", "%d" ); eq( lpMm_new.iVertGap, lpMm_cur.iVertGap, "iVertGap", "%d" );
eq( lpMm_new.iArrange, lpMm_cur.iArrange, "iArrange", "%d" ); eq( lpMm_new.iArrange, lpMm_cur.iArrange, "iArrange", "%d" );
/* test registry */
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINWIDTH_VALNAME, dpi);
ok( regval == lpMm_new.iWidth, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iWidth);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINHORZGAP_VALNAME, dpi);
ok( regval == lpMm_new.iHorzGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iHorzGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINVERTGAP_VALNAME, dpi);
ok( regval == lpMm_new.iVertGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iVertGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINARRANGE_VALNAME, dpi);
ok( regval == lpMm_new.iArrange, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iArrange);
/* test some system metrics */
eq( GetSystemMetrics( SM_CXMINIMIZED ) - 6, eq( GetSystemMetrics( SM_CXMINIMIZED ) - 6,
lpMm_new.iWidth, "iWidth", "%d" ); lpMm_new.iWidth, "iWidth", "%d" );
eq( GetSystemMetrics( SM_CXMINSPACING ) - GetSystemMetrics( SM_CXMINIMIZED ), eq( GetSystemMetrics( SM_CXMINSPACING ) - GetSystemMetrics( SM_CXMINIMIZED ),
...@@ -1224,13 +1260,53 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */ ...@@ -1224,13 +1260,53 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
lpMm_new.iVertGap, "iVertGap", "%d" ); lpMm_new.iVertGap, "iVertGap", "%d" );
eq( GetSystemMetrics( SM_ARRANGE ), eq( GetSystemMetrics( SM_ARRANGE ),
lpMm_new.iArrange, "iArrange", "%d" ); lpMm_new.iArrange, "iArrange", "%d" );
/* now some realy invalid settings */
rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_orig, FALSE ); lpMm_cur.iWidth = -1;
lpMm_cur.iHorzGap = -1;
lpMm_cur.iVertGap = -1;
lpMm_cur.iArrange = - 1;
rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
&lpMm_cur, SPIF_UPDATEINIFILE );
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
/* read back */
rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
/* the width and H/V gaps have minimum 0, arrange is and'd with 0xf */
eq( lpMm_new.iWidth, 0, "iWidth", "%d" );
eq( lpMm_new.iHorzGap, 0, "iHorzGap", "%d" );
eq( lpMm_new.iVertGap, 0, "iVertGap", "%d" );
eq( lpMm_new.iArrange, 0xf & lpMm_cur.iArrange, "iArrange", "%d" );
/* test registry */
#if 0 /* FIXME: cannot understand the results of this (11, 11, 11, 0) */
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINWIDTH_VALNAME, dpi);
ok( regval == lpMm_new.iWidth, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iWidth);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINHORZGAP_VALNAME, dpi);
ok( regval == lpMm_new.iHorzGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iHorzGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINVERTGAP_VALNAME, dpi);
ok( regval == lpMm_new.iVertGap, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iVertGap);
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINARRANGE_VALNAME, dpi);
ok( regval == lpMm_new.iArrange, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iArrange);
#endif
/* test some system metrics */
eq( GetSystemMetrics( SM_CXMINIMIZED ) - 6,
lpMm_new.iWidth, "iWidth", "%d" );
eq( GetSystemMetrics( SM_CXMINSPACING ) - GetSystemMetrics( SM_CXMINIMIZED ),
lpMm_new.iHorzGap, "iHorzGap", "%d" );
eq( GetSystemMetrics( SM_CYMINSPACING ) - GetSystemMetrics( SM_CYMINIMIZED ),
lpMm_new.iVertGap, "iVertGap", "%d" );
eq( GetSystemMetrics( SM_ARRANGE ),
lpMm_new.iArrange, "iArrange", "%d" );
/* restore */
rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
&lpMm_orig, SPIF_UPDATEINIFILE );
ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
/* check that */
rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE ); rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
eq( lpMm_new.iWidth, lpMm_orig.iWidth, "iWidth", "%d" ); eq( lpMm_new.iWidth, lpMm_orig.iWidth, "iWidth", "%d" );
eq( lpMm_new.iHorzGap, lpMm_orig.iHorzGap, "iHorzGap", "%d" ); eq( lpMm_new.iHorzGap, lpMm_orig.iHorzGap, "iHorzGap", "%d" );
eq( lpMm_new.iVertGap, lpMm_orig.iVertGap, "iVertGap", "%d" ); eq( lpMm_new.iVertGap, lpMm_orig.iVertGap, "iVertGap", "%d" );
......
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