summaryrefslogtreecommitdiff
path: root/vcl/inc/win
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-08-24 13:41:37 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-09-22 13:00:13 +0200
commit448e9da1b440561441602e3a0956218b2702767e (patch)
tree4282d5093419247ffd8d2dc55af0ede3623ba6b2 /vcl/inc/win
parent43fd2b2597ce7ac3307794c712e4d8e29e26db5c (diff)
tdf#111994 WIN workaround PostMessage delays
Fixes the "Multiple timers in queue" assertion by effectively removing it. When debugging it became obvious, that PostMessage returns, even if the message was not yet added to the message queue. The assert happens, because we start the timer in the Scheduler before Invoke(), so it fires, if we block in Invoke(), and then reset the timer after Invoke, if there were changes to the Task list. In this case it fires during Invoke(), the message is added. We restart the timer, first by stopping it (we wait in DeleteTimerQueueTimer, to be sure the timer function has either finished or was not run). And the try to remove the message with PeekMessageW, which doesn't remove the posted message. Then the timer is restarted, and when the event is processed, we end up with an additional timer event, which was asserted. As a fix this adds a (microsecond) timestamp to the timer message, which is validated in the WinProc function. So if we stop the timer too fast, the event is ignored based on the timestamp. And while at it, the patch moves timer related variables from SalData into WinSalTimer. Change-Id: Ib840a421e8bd040d40f39473e1d44491e5b332bd Reviewed-on: https://gerrit.libreoffice.org/42575 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/inc/win')
-rw-r--r--vcl/inc/win/saldata.hxx4
-rw-r--r--vcl/inc/win/saltimer.h29
2 files changed, 26 insertions, 7 deletions
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index bc5b9c5db1eb..245d986915b1 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -84,8 +84,6 @@ public:
long* mpDitherDiff; // Dither mapping table
BYTE* mpDitherLow; // Dither mapping table
BYTE* mpDitherHigh; // Dither mapping table
- HANDLE mnTimerId; ///< Windows timer id
- bool mbOnIdleRunScheduler; ///< Run yield until the scheduler processed the idle
HHOOK mhSalObjMsgHook; // hook to get interesting msg for SalObject
HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message
AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test
@@ -178,8 +176,6 @@ void ImplSalYieldMutexRelease();
LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
-void EmitTimerCallback();
-
void SalTestMouseLeave();
bool ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index 084a25745b87..9107dd1a0b19 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -24,16 +24,39 @@
class WinSalTimer : public SalTimer
{
+ HANDLE m_nTimerId; ///< Windows timer id
+ sal_uInt32 m_nTimerStartTicks; ///< system ticks at timer start % SAL_MAX_UINT32
+ bool m_bPollForMessage; ///< Run yield until a message is caught (most likely the 0ms timer)
+
public:
- WinSalTimer() {}
+ WinSalTimer();
virtual ~WinSalTimer() override;
virtual void Start(sal_uIntPtr nMS) override;
virtual void Stop() override;
+
+ inline bool IsValidWPARAM( WPARAM wParam ) const;
+
+ inline bool PollForMessage() const;
+
+ // The Impl functions are just public to be called from the static
+ // SalComWndProc on main thread redirect! Otherwise they would be private.
+ // They must be called from the main application thread only!
+
+ void ImplStart( sal_uIntPtr nMS );
+ void ImplStop();
+ void ImplEmitTimerCallback();
};
-void ImplSalStartTimer( sal_uIntPtr nMS );
-void ImplSalStopTimer();
+inline bool WinSalTimer::IsValidWPARAM( WPARAM aWPARAM ) const
+{
+ return aWPARAM == m_nTimerStartTicks;
+}
+
+inline bool WinSalTimer::PollForMessage() const
+{
+ return m_bPollForMessage;
+}
#endif