Alexandre Julliard : user32: Scale cursor sizes with the screen DPI.

Alexandre Julliard julliard at winehq.org
Wed Jul 5 15:41:02 CDT 2017


Module: wine
Branch: master
Commit: d4654e5799ffb02c025b0f41ccbf617e595186d0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d4654e5799ffb02c025b0f41ccbf617e595186d0

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul  5 20:20:05 2017 +0200

user32: Scale cursor sizes with the screen DPI.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/sysparams.c       |  6 ++++++
 dlls/user32/tests/sysparams.c | 12 ++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index bec4d66..97f6b57 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -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;
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index b5ab784..fa473c1 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -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));




More information about the wine-cvs mailing list