[Bf-blender-cvs] [9d6d5b9bebd] master: Fix T82445: Wintab packets being discarded.

Nicholas Rishel noreply at git.blender.org
Wed Nov 18 23:33:52 CET 2020


Commit: 9d6d5b9bebd1d58d635539652232a1862d10e0bc
Author: Nicholas Rishel
Date:   Wed Nov 18 13:34:15 2020 -0800
Branches: master
https://developer.blender.org/rB9d6d5b9bebd1d58d635539652232a1862d10e0bc

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.

===================================================================

M	intern/ghost/intern/GHOST_WindowWin32.cpp

===================================================================

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;
     }
   }



More information about the Bf-blender-cvs mailing list