@@ -1496,21 +1496,26 @@ void PMTraceConsumer::HandleWin32kEvent(EVENT_RECORD* pEventRecord)
14961496 if (ii->second .Time < mLastInputDeviceReadTime ) {
14971497 ii->second .Time = mLastInputDeviceReadTime ;
14981498 ii->second .Type = mLastInputDeviceType ;
1499- if (mLastInputDeviceType == InputDeviceType::Mouse) {
1500- auto it = mReceivedMouseClickByHwnd .find (hWnd);
1501- if (it != mReceivedMouseClickByHwnd .end ()) {
1502- // If the time from the last mouse click time to this input
1503- // is greater than 1500000 ticks then we assume this is a mouse
1504- // click down and record the time. If the user happens to be
1505- // holding down the mouse button this could be incorrect. In addition
1506- // if we now have a xform time when we previously didn't then record
1507- // the time.
1508- if (it->second .CurrentMouseClickTime - it->second .LastMouseClickTime > 1500000 ) {
1509- ii->second .MouseClickTime = it->second .CurrentMouseClickTime ;
1510- ii->second .XFormTime = it->second .CurrentXFormTime ;
1511- it->second .LastMouseClickTime = it->second .CurrentMouseClickTime ;
1512- it->second .LastXFormTime = it->second .CurrentXFormTime ;
1513- }
1499+ }
1500+ // We can recieve multiple RetrieveInputMessage_Info events
1501+ // before we receive an OnInputXformUpdate_Info event. Because
1502+ // of this if the last device input type was a mouse
1503+ // check to see if it was a mouse click and update if
1504+ // necessary
1505+ if (mLastInputDeviceType == InputDeviceType::Mouse) {
1506+ auto it = mReceivedMouseClickByHwnd .find (hWnd);
1507+ if (it != mReceivedMouseClickByHwnd .end ()) {
1508+ // If the time from the last mouse click time to this input
1509+ // is greater than 1700000 ticks then we assume this is a mouse
1510+ // click down and record the time. If the user happens to be
1511+ // holding down the mouse button this could be incorrect. In addition
1512+ // if we now have a xform time when we previously didn't then record
1513+ // the time.
1514+ if (it->second .CurrentMouseClickTime - it->second .LastMouseClickTime > 1700000 ) {
1515+ ii->second .MouseClickTime = it->second .CurrentMouseClickTime ;
1516+ ii->second .XFormTime = it->second .CurrentXFormTime ;
1517+ it->second .LastMouseClickTime = it->second .CurrentMouseClickTime ;
1518+ it->second .LastXFormTime = it->second .CurrentXFormTime ;
15141519 }
15151520 }
15161521 }
0 commit comments