Jacek Caban : win32u: Move ScreenToClient implementation from user32.

Alexandre Julliard julliard at winehq.org
Wed Mar 23 17:03:55 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar 23 14:02:18 2022 +0100

win32u: Move ScreenToClient implementation from user32.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/winpos.c | 16 ++--------------
 dlls/win32u/window.c | 20 ++++++++++++++++++++
 include/ntuser.h     |  1 +
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index fa074e9f7c8..5ab43089a91 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -432,21 +432,9 @@ BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
 /*******************************************************************
  *		ScreenToClient (USER32.@)
  */
-BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
+BOOL WINAPI ScreenToClient( HWND hwnd, POINT *pt )
 {
-    POINT offset;
-    BOOL mirrored;
-
-    if (!hwnd)
-    {
-        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
-        return FALSE;
-    }
-    if (!WINPOS_GetWinOffset( 0, hwnd, &mirrored, &offset )) return FALSE;
-    lppnt->x += offset.x;
-    lppnt->y += offset.y;
-    if (mirrored) lppnt->x = -lppnt->x;
-    return TRUE;
+    return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserScreenToClient );
 }
 
 
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index f51c7e760ce..59761b8185c 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -2587,6 +2587,24 @@ other_process:  /* one of the parents may belong to another process, do it the h
     return ret;
 }
 
+/* see ScreenToClient */
+static BOOL screen_to_client( HWND hwnd, POINT *pt )
+{
+    POINT offset;
+    BOOL mirrored;
+
+    if (!hwnd)
+    {
+        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+        return FALSE;
+    }
+    if (!get_windows_offset( 0, hwnd, get_thread_dpi(), &mirrored, &offset )) return FALSE;
+    pt->x += offset.x;
+    pt->y += offset.y;
+    if (mirrored) pt->x = -pt->x;
+    return TRUE;
+}
+
 /* map coordinates of a window region */
 void map_window_region( HWND from, HWND to, HRGN hrgn )
 {
@@ -5019,6 +5037,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
         return kill_system_timer( hwnd, param );
     case NtUserMonitorFromWindow:
         return HandleToUlong( monitor_from_window( hwnd, param, NtUserMonitorFromWindow ));
+    case NtUserScreenToClient:
+        return screen_to_client( hwnd, (POINT *)param );
     case NtUserSetCaptureWindow:
         return set_capture_window( hwnd, param, NULL );
     case NtUserSetForegroundWindow:
diff --git a/include/ntuser.h b/include/ntuser.h
index 5b7cc0be597..da0a8974004 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -212,6 +212,7 @@ enum
     NtUserIsChild,
     NtUserKillSystemTimer,
     NtUserMonitorFromWindow,
+    NtUserScreenToClient,
     NtUserSetCaptureWindow,
     NtUserSetForegroundWindow,
     NtUserSetWindowPixelFormat,




More information about the wine-cvs mailing list