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

win32u: Introduce inline helpers for NtUserCallHwndParam calls.

parent 31dbce96
......@@ -695,7 +695,7 @@ HRGN WINAPI CreatePolygonRgn( const POINT *points, INT count, INT mode )
*/
BOOL WINAPI MirrorRgn( HWND hwnd, HRGN hrgn )
{
return NtUserCallHwndParam( hwnd, HandleToUlong(hrgn), NtUserMirrorRgn );
return NtUserMirrorRgn( hwnd, hrgn );
}
/***********************************************************************
......
......@@ -493,7 +493,7 @@ BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
*/
WORD WINAPI GetClassWord( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetClassWord );
return NtUserGetClassWord( hwnd, offset );
}
......@@ -502,7 +502,7 @@ WORD WINAPI GetClassWord( HWND hwnd, INT offset )
*/
DWORD WINAPI GetClassLongW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetClassLongW );
return NtUserGetClassLongW( hwnd, offset );
}
......@@ -512,7 +512,7 @@ DWORD WINAPI GetClassLongW( HWND hwnd, INT offset )
*/
DWORD WINAPI GetClassLongA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetClassLongA );
return NtUserGetClassLongA( hwnd, offset );
}
......@@ -777,7 +777,7 @@ BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry )
*/
ULONG_PTR WINAPI GetClassLongPtrA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetClassLongPtrA );
return NtUserGetClassLongPtrA( hwnd, offset );
}
/***********************************************************************
......@@ -785,7 +785,7 @@ ULONG_PTR WINAPI GetClassLongPtrA( HWND hwnd, INT offset )
*/
ULONG_PTR WINAPI GetClassLongPtrW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetClassLongPtrW );
return NtUserGetClassLongPtrW( hwnd, offset );
}
/***********************************************************************
......
......@@ -39,7 +39,7 @@
*/
BOOL FOCUS_MouseActivate( HWND hwnd )
{
return NtUserCallHwndParam( hwnd, TRUE, NtUserSetForegroundWindow );
return NtUserSetForegroundWindow( hwnd, TRUE );
}
......@@ -48,7 +48,7 @@ BOOL FOCUS_MouseActivate( HWND hwnd )
*/
BOOL WINAPI SetForegroundWindow( HWND hwnd )
{
return NtUserCallHwndParam( hwnd, FALSE, NtUserSetForegroundWindow );
return NtUserSetForegroundWindow( hwnd, FALSE );
}
......
......@@ -1318,7 +1318,7 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
*/
BOOL WINAPI KillSystemTimer( HWND hwnd, UINT_PTR id )
{
return NtUserCallHwndParam( hwnd, id, NtUserKillSystemTimer );
return NtUserKillSystemTimer( hwnd, id );
}
......
......@@ -1013,7 +1013,7 @@ HMONITOR WINAPI MonitorFromPoint( POINT pt, DWORD flags )
*/
HMONITOR WINAPI MonitorFromWindow( HWND hwnd, DWORD flags )
{
return UlongToHandle( NtUserCallHwndParam( hwnd, flags, NtUserMonitorFromWindow ));
return NtUserMonitorFromWindow( hwnd, flags );
}
/***********************************************************************
......
......@@ -941,7 +941,7 @@ UINT WINAPI GetDpiForWindow( HWND hwnd )
*/
WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowWord );
return NtUserGetWindowWord( hwnd, offset );
}
......@@ -961,7 +961,7 @@ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset )
return 0;
#endif
default:
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongA );
return NtUserGetWindowLongA( hwnd, offset );
}
}
......@@ -982,7 +982,7 @@ LONG WINAPI GetWindowLongW( HWND hwnd, INT offset )
return 0;
#endif
default:
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongW );
return NtUserGetWindowLongW( hwnd, offset );
}
}
......@@ -1244,7 +1244,7 @@ BOOL WINAPI IsWindow( HWND hwnd )
*/
DWORD WINAPI GetWindowThreadProcessId( HWND hwnd, LPDWORD process )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)process, NtUserGetWindowThread );
return NtUserGetWindowThread( hwnd, process );
}
......@@ -1262,7 +1262,7 @@ HWND WINAPI GetParent( HWND hwnd )
*/
BOOL WINAPI IsChild( HWND parent, HWND child )
{
return NtUserCallHwndParam( parent, HandleToUlong(child), NtUserIsChild );
return NtUserIsChild( parent, child );
}
......@@ -1304,7 +1304,7 @@ HWND WINAPI GetTopWindow( HWND hwnd )
*/
HWND WINAPI GetWindow( HWND hwnd, UINT rel )
{
return UlongToHandle( NtUserCallHwndParam( hwnd, rel, NtUserGetWindowRelative ));
return NtUserGetWindowRelative( hwnd, rel );
}
......@@ -1683,7 +1683,7 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo( HWND hwnd, WINDOWINFO *info )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserGetWindowInfo );
return NtUserGetWindowInfo( hwnd, info );
}
/******************************************************************************
......@@ -1703,7 +1703,7 @@ BOOL WINAPI SwitchDesktop( HDESK hDesktop)
*/
BOOL CDECL __wine_set_pixel_format( HWND hwnd, int format )
{
return NtUserCallHwndParam( hwnd, format, NtUserSetWindowPixelFormat );
return NtUserSetWindowPixelFormat( hwnd, format );
}
......@@ -1826,7 +1826,7 @@ BOOL WINAPI SetProcessDefaultLayout( DWORD layout )
*/
LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrW );
return NtUserGetWindowLongPtrW( hwnd, offset );
}
/*****************************************************************************
......@@ -1834,7 +1834,7 @@ LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
*/
LONG_PTR WINAPI GetWindowLongPtrA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrA );
return NtUserGetWindowLongPtrA( hwnd, offset );
}
/*****************************************************************************
......
......@@ -60,7 +60,6 @@ static inline void WIN_ReleasePtr( WND *ptr )
extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN;
extern MINMAXINFO WINPOS_GetMinMaxInfo( HWND hwnd ) DECLSPEC_HIDDEN;
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos) DECLSPEC_HIDDEN;
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest ) DECLSPEC_HIDDEN;
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
......
......@@ -64,7 +64,7 @@ void WINAPI SwitchToThisWindow( HWND hwnd, BOOL alt_tab )
*/
BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
{
BOOL ret = NtUserCallHwndParam( hwnd, (UINT_PTR)rect, NtUserGetWindowRect );
BOOL ret = NtUserGetWindowRect( hwnd, rect );
if (ret) TRACE( "hwnd %p %s\n", hwnd, wine_dbgstr_rect(rect) );
return ret;
}
......@@ -105,7 +105,7 @@ int WINAPI GetWindowRgnBox( HWND hwnd, LPRECT prect )
*/
BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)rect, NtUserGetClientRect );
return NtUserGetClientRect( hwnd, rect );
}
......@@ -434,7 +434,7 @@ BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
*/
BOOL WINAPI ScreenToClient( HWND hwnd, POINT *pt )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserScreenToClient );
return NtUserScreenToClient( hwnd, pt );
}
......@@ -514,18 +514,6 @@ static BOOL get_work_rect( HWND hwnd, RECT *rect )
}
/*******************************************************************
* WINPOS_GetMinMaxInfo
*
* Get the minimized and maximized information for a window.
*/
MINMAXINFO WINPOS_GetMinMaxInfo( HWND hwnd )
{
MINMAXINFO info;
NtUserCallHwndParam( hwnd, (UINT_PTR)&info, NtUserGetMinMaxInfo );
return info;
}
/***********************************************************************
* GetInternalWindowPos (USER32.@)
*/
......@@ -594,7 +582,7 @@ static void update_maximized_pos( WND *wnd, RECT *work_rect )
*/
BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)wndpl, NtUserGetWindowPlacement );
return NtUserGetWindowPlacement( hwnd, wndpl );
}
/* make sure the specified rect is visible on screen */
......@@ -849,7 +837,7 @@ LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
if (winpos->flags & SWP_NOSIZE) return 0;
if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
{
MINMAXINFO info = WINPOS_GetMinMaxInfo( hwnd );
MINMAXINFO info = NtUserGetMinMaxInfo( hwnd );
winpos->cx = min( winpos->cx, info.ptMaxTrackSize.x );
winpos->cy = min( winpos->cy, info.ptMaxTrackSize.y );
if (!(style & WS_MINIMIZE))
......@@ -1081,7 +1069,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Get min/max info */
minmax = WINPOS_GetMinMaxInfo( hwnd );
minmax = NtUserGetMinMaxInfo( hwnd );
WIN_GetRectangles( hwnd, COORDS_PARENT, &sizingRect, NULL );
origRect = sizingRect;
if (style & WS_CHILD)
......
......@@ -5019,67 +5019,95 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
{
switch (code)
{
case NtUserGetClassLongA:
case NtUserCallHwndParam_GetClassLongA:
return get_class_long( hwnd, param, TRUE );
case NtUserGetClassLongW:
case NtUserCallHwndParam_GetClassLongW:
return get_class_long( hwnd, param, FALSE );
case NtUserGetClassLongPtrA:
case NtUserCallHwndParam_GetClassLongPtrA:
return get_class_long_ptr( hwnd, param, TRUE );
case NtUserGetClassLongPtrW:
case NtUserCallHwndParam_GetClassLongPtrW:
return get_class_long_ptr( hwnd, param, FALSE );
case NtUserGetClassWord:
case NtUserCallHwndParam_GetClassWord:
return get_class_word( hwnd, param );
case NtUserGetClientRect:
case NtUserCallHwndParam_GetClientRect:
return get_client_rect( hwnd, (RECT *)param );
case NtUserGetMinMaxInfo:
case NtUserCallHwndParam_GetMinMaxInfo:
*(MINMAXINFO *)param = get_min_max_info( hwnd );
return 0;
case NtUserGetWindowInfo:
case NtUserCallHwndParam_GetWindowInfo:
return get_window_info( hwnd, (WINDOWINFO *)param );
case NtUserGetWindowLongA:
case NtUserCallHwndParam_GetWindowLongA:
return get_window_long_size( hwnd, param, sizeof(LONG), TRUE );
case NtUserGetWindowLongW:
case NtUserCallHwndParam_GetWindowLongW:
return get_window_long( hwnd, param );
case NtUserGetWindowLongPtrA:
case NtUserCallHwndParam_GetWindowLongPtrA:
return get_window_long_ptr( hwnd, param, TRUE );
case NtUserGetWindowLongPtrW:
case NtUserCallHwndParam_GetWindowLongPtrW:
return get_window_long_ptr( hwnd, param, FALSE );
case NtUserGetWindowPlacement:
case NtUserCallHwndParam_GetWindowPlacement:
return get_window_placement( hwnd, (WINDOWPLACEMENT *)param );
case NtUserGetWindowRect:
case NtUserCallHwndParam_GetWindowRect:
return get_window_rect( hwnd, (RECT *)param, get_thread_dpi() );
case NtUserGetWindowRelative:
case NtUserCallHwndParam_GetWindowRelative:
return HandleToUlong( get_window_relative( hwnd, param ));
case NtUserGetWindowThread:
case NtUserCallHwndParam_GetWindowThread:
return get_window_thread( hwnd, (DWORD *)param );
case NtUserGetWindowWord:
case NtUserCallHwndParam_GetWindowWord:
return get_window_word( hwnd, param );
case NtUserIsChild:
case NtUserCallHwndParam_IsChild:
return is_child( hwnd, UlongToHandle(param) );
case NtUserKillSystemTimer:
case NtUserCallHwndParam_KillSystemTimer:
return kill_system_timer( hwnd, param );
case NtUserMirrorRgn:
case NtUserCallHwndParam_MirrorRgn:
return mirror_window_region( hwnd, UlongToHandle(param) );
case NtUserMonitorFromWindow:
return HandleToUlong( monitor_from_window( hwnd, param, NtUserMonitorFromWindow ));
case NtUserScreenToClient:
case NtUserCallHwndParam_MonitorFromWindow:
return HandleToUlong( monitor_from_window( hwnd, param, get_thread_dpi() ));
case NtUserCallHwndParam_ScreenToClient:
return screen_to_client( hwnd, (POINT *)param );
case NtUserSetCaptureWindow:
return set_capture_window( hwnd, param, NULL );
case NtUserSetForegroundWindow:
case NtUserCallHwndParam_SetForegroundWindow:
return set_foreground_window( hwnd, param );
case NtUserSetWindowPixelFormat:
case NtUserCallHwndParam_SetWindowPixelFormat:
return set_window_pixel_format( hwnd, param );
/* temporary exports */
case NtUserIsWindowDrawable:
return is_window_drawable( hwnd, param );
case NtUserSetCaptureWindow:
return set_capture_window( hwnd, param, NULL );
case NtUserSetWindowStyle:
{
STYLESTRUCT *style = (void *)param;
return set_window_style( hwnd, style->styleNew, style->styleOld );
}
case NtUserSpyGetMsgName:
return (UINT_PTR)debugstr_msg_name( param, hwnd );
default:
FIXME( "invalid code %u\n", code );
return 0;
......
......@@ -131,40 +131,6 @@ struct win_hook_params
#define NTUSER_DPI_PER_MONITOR_AWARE_V2 0x00000022
#define NTUSER_DPI_PER_UNAWARE_GDISCALED 0x40006010
/* NtUserCallHwndParam codes, not compatible with Windows */
enum
{
NtUserGetClassLongA,
NtUserGetClassLongW,
NtUserGetClassLongPtrA,
NtUserGetClassLongPtrW,
NtUserGetClassWord,
NtUserGetClientRect,
NtUserGetMinMaxInfo,
NtUserGetWindowInfo,
NtUserGetWindowLongA,
NtUserGetWindowLongW,
NtUserGetWindowLongPtrA,
NtUserGetWindowLongPtrW,
NtUserGetWindowPlacement,
NtUserGetWindowRect,
NtUserGetWindowRelative,
NtUserGetWindowThread,
NtUserGetWindowWord,
NtUserIsChild,
NtUserKillSystemTimer,
NtUserMirrorRgn,
NtUserMonitorFromWindow,
NtUserScreenToClient,
NtUserSetCaptureWindow,
NtUserSetForegroundWindow,
NtUserSetWindowPixelFormat,
/* temporary exports */
NtUserIsWindowDrawable,
NtUserSetWindowStyle,
NtUserSpyGetMsgName,
};
/* NtUserMessageCall codes */
enum
{
......@@ -861,4 +827,163 @@ static inline BOOL NtUserIsWindowVisible( HWND hwnd )
return NtUserCallHwnd( hwnd, NtUserCallHwnd_IsWindowVisible );
}
/* NtUserCallHwndParam codes, not compatible with Windows */
enum
{
NtUserCallHwndParam_GetClassLongA,
NtUserCallHwndParam_GetClassLongW,
NtUserCallHwndParam_GetClassLongPtrA,
NtUserCallHwndParam_GetClassLongPtrW,
NtUserCallHwndParam_GetClassWord,
NtUserCallHwndParam_GetClientRect,
NtUserCallHwndParam_GetMinMaxInfo,
NtUserCallHwndParam_GetWindowInfo,
NtUserCallHwndParam_GetWindowLongA,
NtUserCallHwndParam_GetWindowLongW,
NtUserCallHwndParam_GetWindowLongPtrA,
NtUserCallHwndParam_GetWindowLongPtrW,
NtUserCallHwndParam_GetWindowPlacement,
NtUserCallHwndParam_GetWindowRect,
NtUserCallHwndParam_GetWindowRelative,
NtUserCallHwndParam_GetWindowThread,
NtUserCallHwndParam_GetWindowWord,
NtUserCallHwndParam_IsChild,
NtUserCallHwndParam_KillSystemTimer,
NtUserCallHwndParam_MirrorRgn,
NtUserCallHwndParam_MonitorFromWindow,
NtUserCallHwndParam_ScreenToClient,
NtUserCallHwndParam_SetForegroundWindow,
NtUserCallHwndParam_SetWindowPixelFormat,
/* temporary exports */
NtUserIsWindowDrawable,
NtUserSetCaptureWindow,
NtUserSetWindowStyle,
NtUserSpyGetMsgName,
};
static inline DWORD NtUserGetClassLongA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassLongA );
}
static inline ULONG_PTR NtUserGetClassLongPtrA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassLongPtrA );
}
static inline ULONG_PTR NtUserGetClassLongPtrW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassLongPtrW );
}
static inline DWORD NtUserGetClassLongW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassLongW );
}
static inline WORD NtUserGetClassWord( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassWord );
}
static inline BOOL NtUserGetClientRect( HWND hwnd, RECT *rect )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)rect, NtUserCallHwndParam_GetClientRect );
}
static inline MINMAXINFO NtUserGetMinMaxInfo( HWND hwnd )
{
MINMAXINFO info;
NtUserCallHwndParam( hwnd, (UINT_PTR)&info, NtUserCallHwndParam_GetMinMaxInfo );
return info;
}
static inline BOOL NtUserGetWindowInfo( HWND hwnd, WINDOWINFO *info )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_GetWindowInfo );
}
static inline LONG NtUserGetWindowLongA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetWindowLongA );
}
static inline LONG_PTR NtUserGetWindowLongPtrA( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetWindowLongPtrA );
}
static inline LONG_PTR NtUserGetWindowLongPtrW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetWindowLongPtrW );
}
static inline LONG NtUserGetWindowLongW( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetWindowLongW );
}
static inline BOOL NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)wndpl,
NtUserCallHwndParam_GetWindowPlacement );
}
static inline BOOL NtUserGetWindowRect( HWND hwnd, RECT *rect )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)rect, NtUserCallHwndParam_GetWindowRect );
}
static inline HWND NtUserGetWindowRelative( HWND hwnd, UINT rel )
{
return UlongToHandle( NtUserCallHwndParam( hwnd, rel,
NtUserCallHwndParam_GetWindowRelative ));
}
static inline DWORD NtUserGetWindowThread( HWND hwnd, DWORD *process )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)process, NtUserCallHwndParam_GetWindowThread );
}
static inline WORD NtUserGetWindowWord( HWND hwnd, INT offset )
{
return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetWindowWord );
}
static inline BOOL NtUserIsChild( HWND parent, HWND child )
{
return NtUserCallHwndParam( parent, HandleToUlong(child), NtUserCallHwndParam_IsChild );
}
static inline BOOL NtUserKillSystemTimer( HWND hwnd, UINT_PTR id )
{
return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_KillSystemTimer );
}
static inline BOOL NtUserMirrorRgn( HWND hwnd, HRGN hrgn )
{
return NtUserCallHwndParam( hwnd, HandleToUlong(hrgn), NtUserCallHwndParam_MirrorRgn );
}
static inline HMONITOR NtUserMonitorFromWindow( HWND hwnd, DWORD flags )
{
ULONG ret = NtUserCallHwndParam( hwnd, flags, NtUserCallHwndParam_MonitorFromWindow );
return UlongToHandle( ret );
}
static inline BOOL NtUserScreenToClient( HWND hwnd, POINT *pt )
{
return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserCallHwndParam_ScreenToClient );
}
static inline BOOL NtUserSetForegroundWindow( HWND hwnd, BOOL mouse )
{
return NtUserCallHwndParam( hwnd, mouse, NtUserCallHwndParam_SetForegroundWindow );
}
static inline BOOL NtUserSetWindowPixelFormat( HWND hwnd, int format )
{
return NtUserCallHwndParam( hwnd, format, NtUserCallHwndParam_SetWindowPixelFormat );
}
#endif /* _NTUSER_ */
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