Jacek Caban : win32u: Move GWLP_HWNDPARENT implementation from user32.

Alexandre Julliard julliard at winehq.org
Tue Mar 8 16:10:49 CST 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar  8 14:24:07 2022 +0100

win32u: Move GWLP_HWNDPARENT 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/win.c    | 14 --------------
 dlls/win32u/window.c |  6 ++++--
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index eecc696023a..fe8d929a102 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2555,21 +2555,11 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B
 }
 
 
-/* FIXME: move to win32u */
-static ULONG_PTR get_hwnd_parent( HWND hwnd )
-{
-    HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
-    if (parent == GetDesktopWindow()) parent = GetWindow( hwnd, GW_OWNER );
-    return (ULONG_PTR)parent;
-}
-
-
 /**********************************************************************
  *		GetWindowWord (USER32.@)
  */
 WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
 {
-    if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
     return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowWord );
 }
 
@@ -2590,7 +2580,6 @@ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset )
         return 0;
 #endif
     default:
-        if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
         return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongA );
     }
 }
@@ -2612,7 +2601,6 @@ LONG WINAPI GetWindowLongW( HWND hwnd, INT offset )
         return 0;
 #endif
     default:
-        if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
         return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongW );
     }
 }
@@ -3805,7 +3793,6 @@ BOOL WINAPI SetProcessDefaultLayout( DWORD layout )
  */
 LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
 {
-    if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
     return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrW );
 }
 
@@ -3814,7 +3801,6 @@ LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
  */
 LONG_PTR WINAPI GetWindowLongPtrA( HWND hwnd, INT offset )
 {
-    if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
     return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrA );
 }
 
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 3ac177d310a..f7f0d4e6a65 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -612,8 +612,10 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans
 
     if (offset == GWLP_HWNDPARENT)
     {
-        FIXME( "GWLP_HWNDPARENT not supported\n" );
-        return 0;
+        HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
+        if (user_callbacks && parent == user_callbacks->pGetDesktopWindow())
+            parent = get_window_relative( hwnd, GW_OWNER );
+        return (ULONG_PTR)parent;
     }
 
     if (!(win = get_win_ptr( hwnd )))




More information about the wine-cvs mailing list