From 211b3192f05c4120fa2dd0e23988e74bdd310830 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 19 Sep 2014 15:48:24 +0200 Subject: fdo#84000: Reimplement the Windows WinSalTimer using Timer Queues. Timer Queues http://msdn.microsoft.com/en-us/library/windows/desktop/ms686796%28v=vs.85%29.aspx allow creating & maintaing high-precision timers. This commit switches the WinSalTimer implementation from using the Timers: http://msdn.microsoft.com/en-us/library/windows/desktop/ms644900%28v=vs.85%29.aspx to Timer Queue Timers. The 'classic' Timers do not have better precision than some 15.6ms (the documentation mentions 10ms, but some measuring seems to confirm that it is more than that). With the Timer Queue Timers, we now have 1ms precision. Incorporates some cleanup from Michael Meeks . Change-Id: I0312a0c9fdc2779258698b24389b24c39e643473 --- vcl/inc/win/saldata.hxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'vcl/inc') diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index d047fc54a857..409ca3eb13e6 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -83,11 +83,11 @@ public: long* mpDitherDiff; // Dither mapping table BYTE* mpDitherLow; // Dither mapping table BYTE* mpDitherHigh; // Dither mapping table - sal_uLong mnTimerMS; // Current Time (in MS) of the Timer - sal_uLong mnTimerOrgMS; // Current Original Time (in MS) + sal_uLong mnTimerMS; // Current Time (in MS) of the Timer + sal_uLong mnTimerOrgMS; // Current Original Time (in MS) DWORD mnNextTimerTime; DWORD mnLastEventTime; - UINT mnTimerId; // windows timer id + HANDLE mnTimerId; ///< Windows timer id bool mbInTimerProc; // timer event is currently being dispatched HHOOK mhSalObjMsgHook; // hook to get interesting msg for SalObject HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message @@ -181,8 +181,7 @@ void ImplSalAcquireYieldMutex( sal_uLong nCount ); LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ); -#define SALTIMERPROC_RECURSIVE 0xffffffff -void CALLBACK SalTimerProc( HWND hWnd, UINT nMsg, UINT_PTR nId, DWORD nTime ); +void EmitTimerCallback(bool bAllowRecursive); void SalTestMouseLeave(); bool ImplWriteLastError( DWORD lastError, const char *szApiCall ); @@ -286,6 +285,9 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ); // POSTFOCUS-Message; wParam == bFocus; lParam == 0 #define SALOBJ_MSG_POSTFOCUS (WM_USER+161) +// Call the Timer's callback from the main thread +#define SAL_MSG_TIMER_CALLBACK (WM_USER+162) + // A/W-Wrapper BOOL ImplPostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); BOOL ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); -- cgit