Module: wine Branch: master Commit: 57b7a9937deb3f01960fc426f6cedf2b79fd7885 URL: http://source.winehq.org/git/wine.git/?a=commit;h=57b7a9937deb3f01960fc426f6...
Author: Sebastian Lackner sebastian@fds-team.de Date: Fri Apr 29 12:34:53 2016 +0200
user32: Implement SetCoalescableTimer and add basic tests.
Signed-off-by: Sebastian Lackner sebastian@fds-team.de Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/message.c | 13 +++++++++++-- dlls/user32/tests/msg.c | 16 ++++++++++++++++ dlls/user32/user32.spec | 1 + include/winuser.h | 7 +++++++ 4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index fb4786b..bc6b661 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -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.@) */ diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 8ab6e15..e39f8a1 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -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++) { diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index c479879..aa10a80 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -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 diff --git a/include/winuser.h b/include/winuser.h index 9c4586f..0c527fb 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -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);