Jacek Caban : win32u: Introduce NtUserMapWindowPoints.

Alexandre Julliard julliard at winehq.org
Thu Apr 14 16:50:34 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Apr 14 14:11:09 2022 +0200

win32u: Introduce NtUserMapWindowPoints.

And use it in 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 | 22 ++--------------------
 dlls/win32u/window.c |  7 +++++++
 include/ntuser.h     | 18 ++++++++++++++++++
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index c38e0fabb1c..14511c22d9d 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -356,27 +356,9 @@ static BOOL WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored, POI
 /*******************************************************************
  *		MapWindowPoints (USER32.@)
  */
-INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT count )
+INT WINAPI MapWindowPoints( HWND hwnd_from, HWND hwnd_to, POINT *points, UINT count )
 {
-    BOOL mirrored;
-    POINT offset;
-    UINT i;
-
-    if (!WINPOS_GetWinOffset( hwndFrom, hwndTo, &mirrored, &offset )) return 0;
-
-    for (i = 0; i < count; i++)
-    {
-        lppt[i].x += offset.x;
-        lppt[i].y += offset.y;
-        if (mirrored) lppt[i].x = -lppt[i].x;
-    }
-    if (mirrored && count == 2)  /* special case for rectangle */
-    {
-        int tmp = lppt[0].x;
-        lppt[0].x = lppt[1].x;
-        lppt[1].x = tmp;
-    }
-    return MAKELONG( LOWORD(offset.x), LOWORD(offset.y) );
+    return NtUserMapWindowPoints( hwnd_from, hwnd_to, points, count );
 }
 
 
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index eefc48a7d2d..3ecbc043fc8 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -5151,6 +5151,13 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
     case NtUserCallHwndParam_KillSystemTimer:
         return kill_system_timer( hwnd, param );
 
+    case NtUserCallHwndParam_MapWindowPoints:
+        {
+            struct map_window_points_params *params = (void *)param;
+            return map_window_points( hwnd, params->hwnd_to, params->points, params->count,
+                                      get_thread_dpi() );
+        }
+
     case NtUserCallHwndParam_MirrorRgn:
         return mirror_window_region( hwnd, UlongToHandle(param) );
 
diff --git a/include/ntuser.h b/include/ntuser.h
index d8228a521e2..41abc1e2e14 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -852,6 +852,7 @@ enum
     NtUserCallHwndParam_GetWindowWord,
     NtUserCallHwndParam_IsChild,
     NtUserCallHwndParam_KillSystemTimer,
+    NtUserCallHwndParam_MapWindowPoints,
     NtUserCallHwndParam_MirrorRgn,
     NtUserCallHwndParam_MonitorFromWindow,
     NtUserCallHwndParam_ScreenToClient,
@@ -968,6 +969,23 @@ static inline BOOL NtUserKillSystemTimer( HWND hwnd, UINT_PTR id )
     return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_KillSystemTimer );
 }
 
+struct map_window_points_params
+{
+    HWND hwnd_to;
+    POINT *points;
+    UINT count;
+};
+
+static inline int NtUserMapWindowPoints( HWND hwnd_from, HWND hwnd_to, POINT *points, UINT count )
+{
+    struct map_window_points_params params;
+    params.hwnd_to = hwnd_to;
+    params.points = points;
+    params.count = count;
+    return NtUserCallHwndParam( hwnd_from, (UINT_PTR)&params,
+                                NtUserCallHwndParam_MapWindowPoints );
+}
+
 static inline BOOL NtUserMirrorRgn( HWND hwnd, HRGN hrgn )
 {
     return NtUserCallHwndParam( hwnd, HandleToUlong(hrgn), NtUserCallHwndParam_MirrorRgn );




More information about the wine-cvs mailing list