Jacek Caban : win32u: Move GetWindowInfo implementation from user32.
Alexandre Julliard
julliard at winehq.org
Wed Mar 9 16:08:44 CST 2022
Module: wine
Branch: master
Commit: 441522add7943e0bfa3cbd81a9d8f93062ba2b6a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=441522add7943e0bfa3cbd81a9d8f93062ba2b6a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 9 15:22:39 2022 +0100
win32u: Move GetWindowInfo 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 | 21 ++-------------------
dlls/win32u/input.c | 8 ++++++++
dlls/win32u/win32u_private.h | 1 +
dlls/win32u/window.c | 20 ++++++++++++++++++++
include/ntuser.h | 1 +
5 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 98396293912..bb792037640 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3214,26 +3214,9 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
*
* Note: tests show that Windows doesn't check cbSize of the structure.
*/
-BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
+BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo( HWND hwnd, WINDOWINFO *info )
{
- RECT rcWindow, rcClient;
-
- if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &rcWindow, &rcClient )) return FALSE;
- if (!pwi) return FALSE;
-
- pwi->rcWindow = rcWindow;
- pwi->rcClient = rcClient;
- pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
- pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
- pwi->dwWindowStatus = ((GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0);
-
- pwi->cxWindowBorders = pwi->rcClient.left - pwi->rcWindow.left;
- pwi->cyWindowBorders = pwi->rcWindow.bottom - pwi->rcClient.bottom;
-
- pwi->atomWindowType = GetClassLongW( hwnd, GCW_ATOM );
- pwi->wCreatorVersion = 0x0400;
-
- return TRUE;
+ return NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserGetWindowInfo );
}
/******************************************************************************
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index 72af32fd471..71f30e7ae20 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1078,3 +1078,11 @@ HWND WINAPI NtUserGetForegroundWindow(void)
SERVER_END_REQ;
return ret;
}
+
+/* see GetActiveWindow */
+HWND get_active_window(void)
+{
+ GUITHREADINFO info;
+ info.cbSize = sizeof(info);
+ return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0;
+}
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 988a009d874..7c8134367c2 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -275,6 +275,7 @@ extern BOOL unhook_windows_hook( INT id, HOOKPROC proc ) DECLSPEC_HIDDEN;
/* input.c */
extern LONG global_key_state_counter DECLSPEC_HIDDEN;
+extern HWND get_active_window(void) DECLSPEC_HIDDEN;
extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
extern DWORD get_input_state(void) DECLSPEC_HIDDEN;
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 84aa052a231..19b2b4335f8 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -1139,6 +1139,24 @@ BOOL get_window_rect( HWND hwnd, RECT *rect )
return get_window_rects( hwnd, COORDS_SCREEN, rect, NULL, get_thread_dpi() );
}
+/* see GetWindowInfo */
+static BOOL get_window_info( HWND hwnd, WINDOWINFO *info )
+{
+
+ if (!info || !get_window_rects( hwnd, COORDS_SCREEN, &info->rcWindow,
+ &info->rcClient, get_thread_dpi() ))
+ return FALSE;
+
+ info->dwStyle = get_window_long( hwnd, GWL_STYLE );
+ info->dwExStyle = get_window_long( hwnd, GWL_EXSTYLE );
+ info->dwWindowStatus = get_active_window() == hwnd ? WS_ACTIVECAPTION : 0;
+ info->cxWindowBorders = info->rcClient.left - info->rcWindow.left;
+ info->cyWindowBorders = info->rcWindow.bottom - info->rcClient.bottom;
+ info->atomWindowType = get_class_long( hwnd, GCW_ATOM, FALSE );
+ info->wCreatorVersion = 0x0400;
+ return TRUE;
+}
+
/*****************************************************************************
* NtUserGetLayeredWindowAttributes (win32u.@)
*/
@@ -1339,6 +1357,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
return get_class_long_ptr( hwnd, param, FALSE );
case NtUserGetClassWord:
return get_class_word( hwnd, param );
+ case NtUserGetWindowInfo:
+ return get_window_info( hwnd, (WINDOWINFO *)param );
case NtUserGetWindowLongA:
return get_window_long_size( hwnd, param, sizeof(LONG), TRUE );
case NtUserGetWindowLongW:
diff --git a/include/ntuser.h b/include/ntuser.h
index f5911d112a2..5192bd63a90 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -160,6 +160,7 @@ enum
NtUserGetClassLongPtrA,
NtUserGetClassLongPtrW,
NtUserGetClassWord,
+ NtUserGetWindowInfo,
NtUserGetWindowLongA,
NtUserGetWindowLongW,
NtUserGetWindowLongPtrA,
More information about the wine-cvs
mailing list