win32u: Move system parameters implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-12-06 03:15:59 +01:00 committed by Alexandre Julliard
parent 338179ae34
commit fdf3015816
14 changed files with 2355 additions and 2445 deletions

View file

@ -275,11 +275,6 @@ static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT s
{
}
static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
{
return FALSE;
}
static void CDECL nulldrv_ThreadDetach( void )
{
}
@ -418,7 +413,7 @@ static struct user_driver_funcs lazy_load_driver =
nulldrv_WindowPosChanging,
nulldrv_WindowPosChanged,
/* system parameters */
nulldrv_SystemParametersInfo,
NULL,
/* thread management */
nulldrv_ThreadDetach
};
@ -469,7 +464,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
SET_USER_FUNC(WindowMessage);
SET_USER_FUNC(WindowPosChanging);
SET_USER_FUNC(WindowPosChanged);
SET_USER_FUNC(SystemParametersInfo);
SET_USER_FUNC(ThreadDetach);
#undef SET_USER_FUNC

View file

@ -2486,7 +2486,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
if ((msg->message == clk_msg.message) &&
(msg->hwnd == clk_msg.hwnd) &&
(msg->wParam == clk_msg.wParam) &&
(msg->time - clk_msg.time < GetDoubleClickTime()) &&
(msg->time - clk_msg.time < NtUserGetDoubleClickTime()) &&
(abs(msg->pt.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) &&
(abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/2))
{

File diff suppressed because it is too large Load diff

View file

@ -297,7 +297,7 @@
@ stdcall GetDlgItemInt(long long ptr long)
@ stdcall GetDlgItemTextA(long long ptr long)
@ stdcall GetDlgItemTextW(long long ptr long)
@ stdcall GetDoubleClickTime()
@ stdcall GetDoubleClickTime() NtUserGetDoubleClickTime
@ stdcall GetDpiForMonitorInternal(long long ptr ptr) NtUserGetDpiForMonitor
@ stdcall GetDpiForSystem()
@ stdcall GetDpiForWindow(long)
@ -703,7 +703,7 @@
@ stdcall SetScrollRange(long long long long long)
@ stdcall SetShellWindow(long)
@ stdcall SetShellWindowEx (long long)
@ stdcall SetSysColors(long ptr ptr)
@ stdcall SetSysColors(long ptr ptr) NtUserSetSysColors
@ stdcall SetSysColorsTemp(ptr ptr long)
@ stdcall SetSystemCursor(long long)
@ stdcall SetSystemMenu(long long)

View file

@ -333,14 +333,14 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
case DESKTOPHORZRES:
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
{
RECT rect = get_virtual_screen_rect();
RECT rect = get_virtual_screen_rect( 0 );
return rect.right - rect.left;
}
return NtGdiGetDeviceCaps( dev->hdc, HORZRES );
case DESKTOPVERTRES:
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
{
RECT rect = get_virtual_screen_rect();
RECT rect = get_virtual_screen_rect( 0 );
return rect.bottom - rect.top;
}
return NtGdiGetDeviceCaps( dev->hdc, VERTRES );
@ -1063,6 +1063,7 @@ static const struct user_driver_funcs lazy_load_driver =
.pSetCursor = loaderdrv_SetCursor,
.pUpdateClipboard = loaderdrv_UpdateClipboard,
.pScrollDC = nulldrv_ScrollDC,
.pSystemParametersInfo = nulldrv_SystemParametersInfo,
};
const struct user_driver_funcs *user_driver = &lazy_load_driver;

View file

@ -1174,7 +1174,10 @@ static struct unix_funcs unix_funcs =
NtUserMapVirtualKeyEx,
NtUserScrollDC,
NtUserSelectPalette,
NtUserSetSysColors,
NtUserShowCursor,
NtUserSystemParametersInfo,
NtUserSystemParametersInfoForDpi,
NtUserToUnicodeEx,
NtUserUnregisterHotKey,
NtUserVkKeyScanEx,

View file

@ -112,6 +112,7 @@ static void * const syscalls[] =
NtUserGetClipboardSequenceNumber,
NtUserGetClipboardViewer,
NtUserGetCursor,
NtUserGetDoubleClickTime,
NtUserGetDpiForMonitor,
NtUserGetKeyState,
NtUserGetKeyboardLayout,

File diff suppressed because it is too large Load diff

View file

@ -922,7 +922,7 @@
@ stub NtUserGetDisplayAutoRotationPreferences
@ stub NtUserGetDisplayAutoRotationPreferencesByProcessId
@ stdcall NtUserGetDisplayConfigBufferSizes(long ptr ptr)
@ stub NtUserGetDoubleClickTime
@ stdcall -syscall NtUserGetDoubleClickTime()
@ stub NtUserGetDpiForCurrentProcess
@ stdcall -syscall NtUserGetDpiForMonitor(long long ptr ptr)
@ stub NtUserGetExtendedPointerDeviceProperty
@ -1227,7 +1227,7 @@
@ stub NtUserSetSensorPresence
@ stub NtUserSetSharedWindowData
@ stub NtUserSetShellWindowEx
@ stub NtUserSetSysColors
@ stdcall NtUserSetSysColors(long ptr ptr)
@ stub NtUserSetSystemCursor
@ stub NtUserSetSystemMenu
@ stub NtUserSetSystemTimer
@ -1271,8 +1271,8 @@
@ stub NtUserSoundSentry
@ stub NtUserStopAndEndInertia
@ stub NtUserSwitchDesktop
@ stub NtUserSystemParametersInfo
@ stub NtUserSystemParametersInfoForDpi
@ stdcall NtUserSystemParametersInfo(long long ptr long)
@ stdcall NtUserSystemParametersInfoForDpi(long long ptr long long)
@ stub NtUserTestForInteractiveUser
@ stub NtUserThunkedMenuInfo
@ stub NtUserThunkedMenuItemInfo

View file

@ -38,6 +38,7 @@ struct user_callbacks
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM );
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
HWND (WINAPI *pWindowFromDC)( HDC );
};
@ -215,7 +216,11 @@ struct unix_funcs
BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN ret_update_rgn, RECT *update_rect );
HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
BOOL (WINAPI *pNtUserSetSysColors)( INT count, const INT *colors, const COLORREF *values );
INT (WINAPI *pNtUserShowCursor)( BOOL show );
BOOL (WINAPI *pNtUserSystemParametersInfo)( UINT action, UINT val, PVOID ptr, UINT winini );
BOOL (WINAPI *pNtUserSystemParametersInfoForDpi)( UINT action, UINT val, PVOID ptr,
UINT winini, UINT dpi );
INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout );
BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id );
@ -241,7 +246,7 @@ struct unix_funcs
};
extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
extern RECT get_virtual_screen_rect( UINT dpi ) DECLSPEC_HIDDEN;
extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
extern NTSTATUS gdi_init(void) DECLSPEC_HIDDEN;

View file

@ -802,12 +802,30 @@ HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
return unix_funcs->pNtUserSelectPalette( hdc, hpal, bkg );
}
BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserSetSysColors( count, colors, values );
}
INT WINAPI NtUserShowCursor( BOOL show )
{
if (!unix_funcs) return 0;
return unix_funcs->pNtUserShowCursor( show );
}
BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, PVOID ptr, UINT winini )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserSystemParametersInfo( action, val, ptr, winini );
}
BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserSystemParametersInfoForDpi( action, val, ptr, winini, dpi );
}
INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout )
{
@ -981,6 +999,15 @@ static BOOL WINAPI call_RedrawWindow( HWND hwnd, const RECT *rect, HRGN rgn, UIN
return pRedrawWindow && pRedrawWindow( hwnd, rect, rgn, flags );
}
static LRESULT WINAPI call_SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
UINT flags, UINT timeout, PDWORD_PTR res_ptr )
{
static LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
if (!pSendMessageTimeoutW) pSendMessageTimeoutW = get_user_proc( "SendMessageTimeoutW", FALSE );
if (!pSendMessageTimeoutW) return 0;
return pSendMessageTimeoutW( hwnd, msg, wparam, lparam, flags, timeout, res_ptr );
}
static HWND WINAPI call_WindowFromDC( HDC hdc )
{
static HWND (WINAPI *pWindowFromDC)( HDC );
@ -997,6 +1024,7 @@ static const struct user_callbacks user_funcs =
call_GetWindowRect,
call_EnumDisplayMonitors,
call_RedrawWindow,
call_SendMessageTimeoutW,
call_WindowFromDC,
};

View file

@ -99,6 +99,7 @@
SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \
SYSCALL_ENTRY( NtUserGetClipboardViewer ) \
SYSCALL_ENTRY( NtUserGetCursor ) \
SYSCALL_ENTRY( NtUserGetDoubleClickTime ) \
SYSCALL_ENTRY( NtUserGetDpiForMonitor ) \
SYSCALL_ENTRY( NtUserGetKeyState ) \
SYSCALL_ENTRY( NtUserGetKeyboardLayout ) \

View file

@ -325,3 +325,8 @@ NTSTATUS WINAPI wow64_NtUserGetDpiForMonitor( UINT *args )
return NtUserGetDpiForMonitor( monitor, type, x, y );
}
NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args )
{
return NtUserGetDoubleClickTime();
}

View file

@ -49,13 +49,20 @@ struct enum_display_monitor_params
/* NtUserCallOneParam codes, not compatible with Windows */
enum
{
NtUserGetSysColor,
NtUserGetSysColorBrush,
NtUserGetSysColorPen,
NtUserGetSystemMetrics,
NtUserRealizePalette,
/* temporary exports */
NtUserGetDeskPattern,
};
/* NtUserCallTwoParam codes, not compatible with Windows */
enum
{
NtUserGetMonitorInfo,
NtUserGetSystemMetricsForDpi,
};
/* this is the structure stored in TEB->Win32ClientInfo */
@ -115,6 +122,7 @@ HWND WINAPI NtUserGetClipboardViewer(void);
HCURSOR WINAPI NtUserGetCursor(void);
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
UINT32 *num_mode_info );
UINT WINAPI NtUserGetDoubleClickTime(void);
BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y );
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
SHORT WINAPI NtUserGetKeyState( INT vkey );
@ -150,8 +158,11 @@ BOOL WINAPI NtUserSetKeyboardState( BYTE *state );
BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown );
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle );
BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values );
BOOL WINAPI NtUserSetThreadDesktop( HDESK handle );
INT WINAPI NtUserShowCursor( BOOL show );
BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT winini );
BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi );
INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout );
BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id );