win32u: Move NtUserSetTimer 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 2022-03-16 15:35:55 +01:00 committed by Alexandre Julliard
parent ea764fbd3e
commit ac8e0ce255
8 changed files with 49 additions and 36 deletions

View File

@ -4408,45 +4408,12 @@ BOOL WINAPI MessageBeep( UINT i )
}
/***********************************************************************
* SetCoalescableTimer (USER32.@)
*/
UINT_PTR WINAPI SetCoalescableTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance )
{
UINT_PTR ret;
WNDPROC winproc = 0;
if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE );
timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM );
SERVER_START_REQ( set_win_timer )
{
req->win = wine_server_user_handle( hwnd );
req->msg = WM_TIMER;
req->id = id;
req->rate = timeout;
req->lparam = (ULONG_PTR)winproc;
if (!wine_server_call_err( req ))
{
ret = reply->id;
if (!ret) ret = TRUE;
}
else ret = 0;
}
SERVER_END_REQ;
TRACE("Added %p %lx %p timeout %d\n", hwnd, id, winproc, timeout );
return ret;
}
/******************************************************************
* SetTimer (USER32.@)
*/
UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
{
return SetCoalescableTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
return NtUserSetTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
}

View File

@ -655,7 +655,7 @@
@ stdcall SetClassWord(long long long) NtUserSetClassWord
@ stdcall SetClipboardData(long long)
@ stdcall SetClipboardViewer(long)
@ stdcall SetCoalescableTimer(long long long ptr long)
@ stdcall SetCoalescableTimer(long long long ptr long) NtUserSetTimer
# @ stub SetConsoleReserveKeys
@ stdcall -import SetCursor(long) NtUserSetCursor
@ stub SetCursorContents

View File

@ -128,6 +128,38 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
return ret;
}
/***********************************************************************
* NtUserSetTimer (win32u.@)
*/
UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance )
{
UINT_PTR ret;
WNDPROC winproc = 0;
if (proc) winproc = alloc_winproc( (WNDPROC)proc, TRUE );
timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM );
SERVER_START_REQ( set_win_timer )
{
req->win = wine_server_user_handle( hwnd );
req->msg = WM_TIMER;
req->id = id;
req->rate = timeout;
req->lparam = (ULONG_PTR)winproc;
if (!wine_server_call_err( req ))
{
ret = reply->id;
if (!ret) ret = TRUE;
}
else ret = 0;
}
SERVER_END_REQ;
TRACE( "Added %p %lx %p timeout %d\n", hwnd, id, winproc, timeout );
return ret;
}
/* see SendMessageW */
LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{

View File

@ -154,6 +154,7 @@ static void * const syscalls[] =
NtUserSetProcessWindowStation,
NtUserSetProp,
NtUserSetThreadDesktop,
NtUserSetTimer,
NtUserSetWinEventHook,
NtUserSetWindowsHookEx,
NtUserUnhookWinEvent,

View File

@ -1236,7 +1236,7 @@
@ stub NtUserSetThreadInputBlocked
@ stub NtUserSetThreadLayoutHandles
@ stub NtUserSetThreadState
@ stub NtUserSetTimer
@ stdcall -syscall NtUserSetTimer(long long long ptr long)
@ stdcall -syscall NtUserSetWinEventHook(long long long ptr ptr long long long)
@ stub NtUserSetWindowArrangement
@ stub NtUserSetWindowBand

View File

@ -139,6 +139,7 @@
SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserSetProp ) \
SYSCALL_ENTRY( NtUserSetThreadDesktop ) \
SYSCALL_ENTRY( NtUserSetTimer ) \
SYSCALL_ENTRY( NtUserSetWinEventHook ) \
SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \
SYSCALL_ENTRY( NtUserUnhookWinEvent ) \

View File

@ -533,6 +533,17 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
return TRUE;
}
NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args )
{
HWND hwnd = get_handle( &args );
UINT_PTR id = get_ulong( &args );
UINT timeout = get_ulong( &args );
TIMERPROC proc = get_ptr( &args );
ULONG tolerance = get_ulong( &args );
return NtUserSetTimer( hwnd, id, timeout, proc, tolerance );
}
NTSTATUS WINAPI wow64_NtUserCopyAcceleratorTable( UINT *args )
{
HACCEL src = get_handle( &args );

View File

@ -403,6 +403,7 @@ 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 );
UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance );
LONG WINAPI NtUserSetWindowLong( HWND hwnd, INT offset, LONG newval, BOOL ansi );
LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );