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

win32u: Move NtUserSetSystemTimer implementation from user32.

parent ac8e0ce2
......@@ -274,7 +274,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
r.left = x;
r.top = y;
CARET_DisplayCaret( hwnd, &r );
SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
}
return ret;
}
......@@ -352,7 +352,7 @@ BOOL WINAPI ShowCaret( HWND hwnd )
if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */
{
CARET_DisplayCaret( hwnd, &r );
SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback );
}
return ret;
}
......
......@@ -862,7 +862,8 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
/* Initialize HoverInfo variables even if not hover tracking */
tracking_info.pos = pos;
timer = SetSystemTimer(tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, hover_time, TrackMouseEventProc);
timer = NtUserSetSystemTimer( tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme,
hover_time, TrackMouseEventProc );
}
}
......
......@@ -2413,7 +2413,7 @@ static void LISTBOX_HandleMouseMove( LB_DESCR *descr,
/* Start/stop the system timer */
if (dir != LB_TIMER_NONE)
SetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL);
NtUserSetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL);
else if (LISTBOX_Timer != LB_TIMER_NONE)
KillSystemTimer( descr->self, LB_TIMER_ID );
LISTBOX_Timer = dir;
......
......@@ -4418,39 +4418,6 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
/***********************************************************************
* SetSystemTimer (USER32.@)
*/
UINT_PTR WINAPI SetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
{
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_SYSTIMER;
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;
}
/***********************************************************************
* KillTimer (USER32.@)
*/
BOOL WINAPI KillTimer( HWND hwnd, UINT_PTR id )
......
......@@ -949,8 +949,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
SB_LINEUP, (LPARAM)hwndCtl );
}
SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
}
else KillSystemTimer( hwnd, SCROLL_TIMER );
break;
......@@ -964,8 +964,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_PAGEUP, (LPARAM)hwndCtl );
}
SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
}
else KillSystemTimer( hwnd, SCROLL_TIMER );
break;
......@@ -1022,8 +1022,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_PAGEDOWN, (LPARAM)hwndCtl );
}
SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
}
else KillSystemTimer( hwnd, SCROLL_TIMER );
break;
......@@ -1038,8 +1038,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
SB_LINEDOWN, (LPARAM)hwndCtl );
}
SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL );
}
else KillSystemTimer( hwnd, SCROLL_TIMER );
break;
......
......@@ -707,7 +707,7 @@
@ stdcall SetSysColorsTemp(ptr ptr long)
@ stdcall SetSystemCursor(long long)
@ stdcall SetSystemMenu(long long)
@ stdcall SetSystemTimer(long long long ptr)
@ stdcall SetSystemTimer(long long long ptr) NtUserSetSystemTimer
@ stdcall SetTaskmanWindow (long)
@ stdcall SetThreadDesktop(long) NtUserSetThreadDesktop
@ stdcall SetThreadDpiAwarenessContext(ptr)
......
......@@ -36,9 +36,6 @@
#define GET_DWORD(ptr) (*(const DWORD *)(ptr))
#define GET_LONG(ptr) (*(const LONG *)(ptr))
#define WM_SYSTIMER 0x0118
#define WM_POPUPSYSTEMMENU 0x0313
#define WINE_MOUSE_HANDLE ((HANDLE)1)
#define WINE_KEYBOARD_HANDLE ((HANDLE)2)
......@@ -132,7 +129,6 @@ typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp
LRESULT *result, void *arg );
extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN;
extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
......
......@@ -193,7 +193,7 @@ WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode )
* lot of windows, it will usually only have a limited number of window procedures, so the
* array won't grow too large, and this way we avoid the need to track allocations per window.
*/
WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode )
static WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode )
{
return (WNDPROC)NtUserCallTwoParam( (UINT_PTR)func, !unicode, NtUserAllocWinProc );
}
......
......@@ -160,6 +160,38 @@ UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC
return ret;
}
/***********************************************************************
* NtUserSetSystemTimer (win32u.@)
*/
UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
{
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_SYSTIMER;
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 )
{
......
......@@ -49,6 +49,9 @@ struct user_callbacks
const RECT *valid_rects );
};
#define WM_SYSTIMER 0x0118
#define WM_POPUPSYSTEMMENU 0x0313
struct user_object
{
HANDLE handle;
......
......@@ -153,6 +153,7 @@ static void * const syscalls[] =
NtUserSetProcessDpiAwarenessContext,
NtUserSetProcessWindowStation,
NtUserSetProp,
NtUserSetSystemTimer,
NtUserSetThreadDesktop,
NtUserSetTimer,
NtUserSetWinEventHook,
......
......@@ -1230,7 +1230,7 @@
@ stdcall NtUserSetSysColors(long ptr ptr)
@ stub NtUserSetSystemCursor
@ stub NtUserSetSystemMenu
@ stub NtUserSetSystemTimer
@ stdcall -syscall NtUserSetSystemTimer(long long long ptr)
@ stub NtUserSetTargetForResourceBrokering
@ stdcall -syscall NtUserSetThreadDesktop(long)
@ stub NtUserSetThreadInputBlocked
......
......@@ -138,6 +138,7 @@
SYSCALL_ENTRY( NtUserSetProcessDpiAwarenessContext ) \
SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserSetProp ) \
SYSCALL_ENTRY( NtUserSetSystemTimer ) \
SYSCALL_ENTRY( NtUserSetThreadDesktop ) \
SYSCALL_ENTRY( NtUserSetTimer ) \
SYSCALL_ENTRY( NtUserSetWinEventHook ) \
......
......@@ -533,6 +533,16 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
return TRUE;
}
NTSTATUS WINAPI wow64_NtUserSetSystemTimer( UINT *args )
{
HWND hwnd = get_handle( &args );
UINT_PTR id = get_ulong( &args );
UINT timeout = get_ulong( &args );
TIMERPROC proc = get_ptr( &args );
return NtUserSetSystemTimer( hwnd, id, timeout, proc );
}
NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args )
{
HWND hwnd = get_handle( &args );
......
......@@ -402,6 +402,7 @@ BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unkno
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 );
UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc );
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 );
......
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