Commit c0b62eb5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Use win32u to get and set MDI client info.

parent 1bd73c6c
......@@ -194,22 +194,7 @@ const struct builtin_class_descr MDICLIENT_builtin_class =
static MDICLIENTINFO *get_client_info( HWND client )
{
MDICLIENTINFO *ret = NULL;
WND *win = WIN_GetPtr( client );
if (win)
{
if (win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{
if (IsWindow(client)) WARN( "client %p belongs to other process\n", client );
return NULL;
}
if (win->flags & WIN_ISMDICLIENT)
ret = ((MDICLIENTINFO **)win->wExtra)[1];
else
WARN( "%p is not an MDI client\n", client );
WIN_ReleasePtr( win );
}
return ret;
return NtUserGetMDIClientInfo( client );
}
static BOOL is_close_enabled(HWND hwnd, HMENU hSysMenu)
......@@ -1038,8 +1023,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (message == WM_NCCREATE)
{
if (!(ci = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ci) ))) return 0;
SetWindowLongPtrW( hwnd, sizeof(void *), (ULONG_PTR)ci );
win_set_flags( hwnd, WIN_ISMDICLIENT, 0 );
NtUserSetMDIClientInfo( hwnd, ci );
}
return unicode ? DefWindowProcW( hwnd, message, wParam, lParam ) :
DefWindowProcA( hwnd, message, wParam, lParam );
......
......@@ -128,7 +128,7 @@ BOOL is_desktop_window( HWND hwnd )
* or WND_OTHER_PROCESS if handle may be valid in other process.
* If ret value is a valid pointer, it must be released with WIN_ReleasePtr.
*/
WND *WIN_GetPtr( HWND hwnd )
static WND *WIN_GetPtr( HWND hwnd )
{
WND *ptr = (void *)NtUserCallTwoParam( HandleToUlong(hwnd), NTUSER_OBJ_WINDOW, NtUserGetHandlePtr );
if (ptr == WND_OTHER_PROCESS && is_desktop_window( hwnd )) ptr = WND_DESKTOP;
......@@ -139,7 +139,7 @@ WND *WIN_GetPtr( HWND hwnd )
/***********************************************************************
* WIN_ReleasePtr
*/
void WIN_ReleasePtr( WND *ptr )
static void WIN_ReleasePtr( WND *ptr )
{
assert( ptr && ptr != OBJ_OTHER_PROCESS );
NtUserCallOneParam( 1, NtUserLock );
......@@ -169,24 +169,6 @@ HWND WIN_IsCurrentThread( HWND hwnd )
/***********************************************************************
* win_set_flags
*
* Set the flags of a window and return the previous value.
*/
UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask )
{
UINT ret;
WND *ptr = WIN_GetPtr( hwnd );
if (!ptr || ptr == WND_OTHER_PROCESS || ptr == WND_DESKTOP) return 0;
ret = ptr->flags;
ptr->flags = (ret & ~clear_mask) | set_mask;
WIN_ReleasePtr( ptr );
return ret;
}
/***********************************************************************
* WIN_GetFullHandle
*
* Convert a possibly truncated window handle to a full 32-bit handle.
......@@ -494,7 +476,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
POINT pos[2];
UINT id = 0;
if (!(win_get_flags( cs->hwndParent ) & WIN_ISMDICLIENT))
if (!NtUserGetMDIClientInfo( cs->hwndParent ))
{
WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", cs->hwndParent);
return 0;
......
......@@ -36,8 +36,6 @@ struct tagDIALOGINFO;
/* Window functions */
extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WIN_ReleasePtr( WND *ptr ) DECLSPEC_HIDDEN;
extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN;
......
......@@ -5410,6 +5410,10 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
case NtUserCallHwnd_GetDialogInfo:
return (ULONG_PTR)get_dialog_info( hwnd );
case NtUserCallHwnd_GetMDIClientInfo:
if (!(win_get_flags( hwnd ) & WIN_ISMDICLIENT)) return 0;
return get_window_long_ptr( hwnd, sizeof(void *), FALSE );
case NtUserCallHwnd_GetWindowContextHelpId:
return get_window_context_help_id( hwnd );
......@@ -5548,6 +5552,10 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
case NtUserCallHwndParam_SetDialogInfo:
return set_dialog_info( hwnd, (void *)param );
case NtUserCallHwndParam_SetMDIClientInfo:
NtUserSetWindowLongPtr( hwnd, sizeof(void *), param, FALSE );
return win_set_flags( hwnd, WIN_ISMDICLIENT, 0 );
case NtUserCallHwndParam_SetWindowContextHelpId:
return set_window_context_help_id( hwnd, param );
......
......@@ -1101,6 +1101,7 @@ enum
NtUserCallHwnd_GetDefaultImeWindow,
NtUserCallHwnd_GetDialogInfo,
NtUserCallHwnd_GetDpiForWindow,
NtUserCallHwnd_GetMDIClientInfo,
NtUserCallHwnd_GetParent,
NtUserCallHwnd_GetWindowContextHelpId,
NtUserCallHwnd_GetWindowDpiAwarenessContext,
......@@ -1148,6 +1149,11 @@ static inline UINT NtUserGetDpiForWindow( HWND hwnd )
return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDpiForWindow );
}
static inline void *NtUserGetMDIClientInfo( HWND hwnd )
{
return (void *)NtUserCallHwnd( hwnd, NtUserCallHwnd_GetMDIClientInfo );
}
static inline HWND NtUserGetParent( HWND hwnd )
{
return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetParent ));
......@@ -1228,6 +1234,7 @@ enum
NtUserCallHwndParam_MonitorFromWindow,
NtUserCallHwndParam_ScreenToClient,
NtUserCallHwndParam_SetDialogInfo,
NtUserCallHwndParam_SetMDIClientInfo,
NtUserCallHwndParam_SetWindowContextHelpId,
NtUserCallHwndParam_SetWindowPixelFormat,
NtUserCallHwndParam_ShowOwnedPopups,
......@@ -1394,6 +1401,11 @@ static inline void NtUserSetDialogInfo( HWND hwnd, void *info )
NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_SetDialogInfo );
}
static inline void NtUserSetMDIClientInfo( HWND hwnd, void *info )
{
NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_SetMDIClientInfo );
}
static inline BOOL NtUserSetWindowContextHelpId( HWND hwnd, DWORD id )
{
return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment