user32: Scale cursor sizes with the screen DPI.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-07-05 20:20:05 +02:00
parent 759dd5517c
commit d4654e5799
2 changed files with 16 additions and 2 deletions

View File

@ -2413,6 +2413,12 @@ INT WINAPI GetSystemMetrics( INT index )
return ret;
case SM_CXCURSOR:
case SM_CYCURSOR:
if (IsProcessDPIAware())
{
ret = MulDiv( 32, get_display_dpi(), USER_DEFAULT_SCREEN_DPI );
if (ret >= 64) return 64;
if (ret >= 48) return 48;
}
return 32;
case SM_CYMENU:
return GetSystemMetrics(SM_CYMENUSIZE) + 1;

View File

@ -2696,6 +2696,14 @@ static BOOL is_font_enumerated(const char *name)
return ret;
}
static int get_cursor_size( int size )
{
/* only certain sizes are allowed for cursors */
if (size >= 64) return 64;
if (size >= 48) return 48;
return 32;
}
static void test_GetSystemMetrics( void)
{
TEXTMETRICA tmMenuFont;
@ -2774,8 +2782,8 @@ static void test_GetSystemMetrics( void)
/* These don't depend on the Shell Icon Size registry value */
ok_gsm( SM_CXICON, MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI ) );
ok_gsm( SM_CYICON, MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI ) );
/* SM_CXCURSOR */
/* SM_CYCURSOR */
ok_gsm( SM_CXCURSOR, get_cursor_size( MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI )));
ok_gsm( SM_CYCURSOR, get_cursor_size( MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI )));
ok_gsm( SM_CYMENU, ncm.iMenuHeight + 1);
ok_gsm( SM_CXFULLSCREEN,
GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME));