diff options
author | Nicholas Rishel <rishel.nick@gmail.com> | 2020-11-19 00:34:15 +0300 |
---|---|---|
committer | Nicholas Rishel <rishel.nick@gmail.com> | 2020-11-19 01:29:51 +0300 |
commit | 9d6d5b9bebd1d58d635539652232a1862d10e0bc (patch) | |
tree | 0205699870c3a29841c9e9c6132a8bc28d67bc40 | |
parent | e9ddb21df356e1c6c21297aa463cdd6bfda8868c (diff) |
Fix T82445: Wintab packets being discarded.
Switched timer to use GetTickCount instead of QueryPerformanceCounter
as Wintab's pkTime seems to (but is not guaranteed to) use the former.
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 5904a72b186..af02663985d 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1401,16 +1401,16 @@ void GHOST_WindowWin32::updatePendingWintabEvents() if (!(m_wintab.packetsGet && m_wintab.context)) { return; } - GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)GHOST_System::getSystem(); auto &pendingEvents = m_wintab.pendingEvents; /* Clear outdated events from queue. */ - GHOST_TUns64 currTime = system->getMilliSeconds(); - GHOST_TUns64 timeout = 300; + DWORD currTime = ::GetTickCount(); + DWORD millisTimeout = 500; while (!pendingEvents.empty()) { - GHOST_TUns64 pktTime = system->millisSinceStart(pendingEvents.front().pkTime); - if (currTime - pktTime > timeout) { + DWORD pkTime = pendingEvents.front().pkTime; + + if (currTime > pkTime + millisTimeout) { pendingEvents.pop(); } else { @@ -1426,8 +1426,9 @@ void GHOST_WindowWin32::updatePendingWintabEvents() /* Don't queue outdated packets, such events can include packets that occurred before the current * window lost and regained focus. */ for (; i < numPackets; i++) { - GHOST_TUns64 pktTime = system->millisSinceStart(m_wintab.pkts[i].pkTime); - if (currTime - pktTime < timeout) { + DWORD pkTime = m_wintab.pkts[i].pkTime; + + if (currTime < pkTime + millisTimeout) { break; } } |