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 ) static void CDECL nulldrv_ThreadDetach( void )
{ {
} }
@ -418,7 +413,7 @@ static struct user_driver_funcs lazy_load_driver =
nulldrv_WindowPosChanging, nulldrv_WindowPosChanging,
nulldrv_WindowPosChanged, nulldrv_WindowPosChanged,
/* system parameters */ /* system parameters */
nulldrv_SystemParametersInfo, NULL,
/* thread management */ /* thread management */
nulldrv_ThreadDetach 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(WindowMessage);
SET_USER_FUNC(WindowPosChanging); SET_USER_FUNC(WindowPosChanging);
SET_USER_FUNC(WindowPosChanged); SET_USER_FUNC(WindowPosChanged);
SET_USER_FUNC(SystemParametersInfo);
SET_USER_FUNC(ThreadDetach); SET_USER_FUNC(ThreadDetach);
#undef SET_USER_FUNC #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) && if ((msg->message == clk_msg.message) &&
(msg->hwnd == clk_msg.hwnd) && (msg->hwnd == clk_msg.hwnd) &&
(msg->wParam == clk_msg.wParam) && (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.x - clk_msg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK)/2) &&
(abs(msg->pt.y - clk_msg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK)/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 GetDlgItemInt(long long ptr long)
@ stdcall GetDlgItemTextA(long long ptr long) @ stdcall GetDlgItemTextA(long long ptr long)
@ stdcall GetDlgItemTextW(long long ptr long) @ stdcall GetDlgItemTextW(long long ptr long)
@ stdcall GetDoubleClickTime() @ stdcall GetDoubleClickTime() NtUserGetDoubleClickTime
@ stdcall GetDpiForMonitorInternal(long long ptr ptr) NtUserGetDpiForMonitor @ stdcall GetDpiForMonitorInternal(long long ptr ptr) NtUserGetDpiForMonitor
@ stdcall GetDpiForSystem() @ stdcall GetDpiForSystem()
@ stdcall GetDpiForWindow(long) @ stdcall GetDpiForWindow(long)
@ -703,7 +703,7 @@
@ stdcall SetScrollRange(long long long long long) @ stdcall SetScrollRange(long long long long long)
@ stdcall SetShellWindow(long) @ stdcall SetShellWindow(long)
@ stdcall SetShellWindowEx (long long) @ stdcall SetShellWindowEx (long long)
@ stdcall SetSysColors(long ptr ptr) @ stdcall SetSysColors(long ptr ptr) NtUserSetSysColors
@ stdcall SetSysColorsTemp(ptr ptr long) @ stdcall SetSysColorsTemp(ptr ptr long)
@ stdcall SetSystemCursor(long long) @ stdcall SetSystemCursor(long long)
@ stdcall SetSystemMenu(long long) @ stdcall SetSystemMenu(long long)

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -38,6 +38,7 @@ struct user_callbacks
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect ); BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM ); BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM );
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT ); BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
HWND (WINAPI *pWindowFromDC)( HDC ); 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, BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN ret_update_rgn, RECT *update_rect ); HRGN ret_update_rgn, RECT *update_rect );
HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg ); 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 ); 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, INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id ); BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id );
@ -241,7 +246,7 @@ struct unix_funcs
}; };
extern UINT get_system_dpi(void) DECLSPEC_HIDDEN; 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 void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
extern NTSTATUS gdi_init(void) 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 ); 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 ) INT WINAPI NtUserShowCursor( BOOL show )
{ {
if (!unix_funcs) return 0; if (!unix_funcs) return 0;
return unix_funcs->pNtUserShowCursor( show ); 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, INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ) 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 ); 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 call_WindowFromDC( HDC hdc )
{ {
static HWND (WINAPI *pWindowFromDC)( HDC ); static HWND (WINAPI *pWindowFromDC)( HDC );
@ -997,6 +1024,7 @@ static const struct user_callbacks user_funcs =
call_GetWindowRect, call_GetWindowRect,
call_EnumDisplayMonitors, call_EnumDisplayMonitors,
call_RedrawWindow, call_RedrawWindow,
call_SendMessageTimeoutW,
call_WindowFromDC, call_WindowFromDC,
}; };

View File

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

View File

@ -325,3 +325,8 @@ NTSTATUS WINAPI wow64_NtUserGetDpiForMonitor( UINT *args )
return NtUserGetDpiForMonitor( monitor, type, x, y ); 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 */ /* NtUserCallOneParam codes, not compatible with Windows */
enum enum
{ {
NtUserGetSysColor,
NtUserGetSysColorBrush,
NtUserGetSysColorPen,
NtUserGetSystemMetrics,
NtUserRealizePalette, NtUserRealizePalette,
/* temporary exports */
NtUserGetDeskPattern,
}; };
/* NtUserCallTwoParam codes, not compatible with Windows */ /* NtUserCallTwoParam codes, not compatible with Windows */
enum enum
{ {
NtUserGetMonitorInfo, NtUserGetMonitorInfo,
NtUserGetSystemMetricsForDpi,
}; };
/* this is the structure stored in TEB->Win32ClientInfo */ /* this is the structure stored in TEB->Win32ClientInfo */
@ -115,6 +122,7 @@ HWND WINAPI NtUserGetClipboardViewer(void);
HCURSOR WINAPI NtUserGetCursor(void); HCURSOR WINAPI NtUserGetCursor(void);
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info, LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
UINT32 *num_mode_info ); UINT32 *num_mode_info );
UINT WINAPI NtUserGetDoubleClickTime(void);
BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y ); BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y );
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size ); INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
SHORT WINAPI NtUserGetKeyState( INT vkey ); SHORT WINAPI NtUserGetKeyState( INT vkey );
@ -150,8 +158,11 @@ BOOL WINAPI NtUserSetKeyboardState( BYTE *state );
BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown ); BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown );
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle ); BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE 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 ); BOOL WINAPI NtUserSetThreadDesktop( HDESK handle );
INT WINAPI NtUserShowCursor( BOOL show ); 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, INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id ); BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id );