user32: Implement SetCoalescableTimer and add basic tests.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-04-29 12:34:53 +02:00 committed by Alexandre Julliard
parent f5b8eb4977
commit 57b7a9937d
4 changed files with 35 additions and 2 deletions

View File

@ -4443,9 +4443,9 @@ BOOL WINAPI MessageBeep( UINT i )
/***********************************************************************
* SetTimer (USER32.@)
* SetCoalescableTimer (USER32.@)
*/
UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
UINT_PTR WINAPI SetCoalescableTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance )
{
UINT_PTR ret;
WNDPROC winproc = 0;
@ -4475,6 +4475,15 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
}
/******************************************************************
* SetTimer (USER32.@)
*/
UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
{
return SetCoalescableTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
}
/***********************************************************************
* SetSystemTimer (USER32.@)
*/

View File

@ -1743,6 +1743,7 @@ static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC);
static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR);
static UINT_PTR (WINAPI *pSetCoalescableTimer)(HWND, UINT_PTR, UINT, TIMERPROC, ULONG);
/* kernel32 functions */
static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA);
@ -1769,6 +1770,7 @@ static void init_procs(void)
GET_PROC(user32, UpdateLayeredWindow)
GET_PROC(user32, SetSystemTimer)
GET_PROC(user32, KillSystemTimer)
GET_PROC(user32, SetCoalescableTimer)
GET_PROC(kernel32, GetCPInfoExA)
@ -8995,6 +8997,20 @@ static void test_timers_no_wnd(void)
KillTimer(NULL, id);
/* Note: SetSystemTimer doesn't support a NULL window, see test_timers */
if (pSetCoalescableTimer)
{
count = 0;
id = pSetCoalescableTimer(NULL, 0, 0, callback_count, 0);
ok(id != 0, "SetCoalescableTimer failed with %u.\n", GetLastError());
start = GetTickCount();
while (GetTickCount()-start < 100 && GetMessageA(&msg, NULL, 0, 0))
DispatchMessageA(&msg);
ok(count > 1, "expected count > 1, got %d.\n", count);
KillTimer(NULL, id);
}
else
win_skip("SetCoalescableTimer not available.\n");
/* Check what happens when we're running out of timers */
for (i=0; i<sizeof(ids)/sizeof(ids[0]); i++)
{

View File

@ -624,6 +624,7 @@
@ stdcall SetClassWord(long long long)
@ stdcall SetClipboardData(long long)
@ stdcall SetClipboardViewer(long)
@ stdcall SetCoalescableTimer(long long long ptr long)
# @ stub SetConsoleReserveKeys
@ stdcall SetCursor(long)
@ stub SetCursorContents

View File

@ -2560,6 +2560,12 @@ typedef struct tagMINIMIZEDMETRICS {
#define USER_TIMER_MINIMUM 0x0000000A
#define USER_TIMER_MAXIMUM 0x7FFFFFFF
/* SetCoalescableTimer() tolerances */
#define TIMERV_DEFAULT_COALESCING 0
#define TIMERV_NO_COALESCING 0xFFFFFFFF
#define TIMERV_COALESCING_MIN 1
#define TIMERV_COALESCING_MAX 0x7FFFFFF5
/* AnimateWindow() flags */
#define AW_SLIDE 0x00040000
#define AW_ACTIVATE 0x00020000
@ -3943,6 +3949,7 @@ WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrW(HWND,INT,LONG_PTR);
WINUSERAPI WORD WINAPI SetClassWord(HWND,INT,WORD);
WINUSERAPI HANDLE WINAPI SetClipboardData(UINT,HANDLE);
WINUSERAPI HWND WINAPI SetClipboardViewer(HWND);
WINUSERAPI UINT_PTR WINAPI SetCoalescableTimer(HWND,UINT_PTR,UINT,TIMERPROC,ULONG);
WINUSERAPI HCURSOR WINAPI SetCursor(HCURSOR);
WINUSERAPI BOOL WINAPI SetCursorPos(INT,INT);
WINUSERAPI VOID WINAPI SetDebugErrorLevel(DWORD);