@@ -267,6 +267,21 @@ void APPB::PositionCurs(long xpScreen, long ypScreen)
267267
268268 // REVIEW shonk: implement on Mac
269269 MacWin (RawRtn (), SetCursorPos (xpScreen, ypScreen));
270+
271+ #ifdef WIN
272+ if (_fFlushCursor)
273+ {
274+ // APPB::TrackMouse gets the mouse position by peeking the message queue for WM_MOUSE* messages.
275+ // After the cursor position has been reset, there may still be some WM_MOUSEMOVE messages with old
276+ // cooordinates in the message queue. This can cause jitter when dragging actors around the stage.
277+ // Flush all mouse move messages from this thread's message queue.
278+ MSG msg;
279+ while (PeekMessage (&msg, hNil, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE | PM_NOYIELD))
280+ {
281+ // do nothing
282+ }
283+ }
284+ #endif // WIN
270285}
271286
272287/* **************************************************************************
@@ -548,6 +563,7 @@ bool APPB::_FInit(ulong grfapp, ulong grfgob, long ginDef)
548563 AssertThis (0 );
549564
550565 _fOffscreen = FPure (grfapp & fappOffscreen);
566+ _fFlushCursor = fTrue ;
551567
552568#ifdef DEBUG
553569 if (!_FInitDebug ())
@@ -1418,6 +1434,10 @@ bool APPB::FSetProp(long prid, long lw)
14181434 ResetToolTip ();
14191435 break ;
14201436
1437+ case kpridReduceMouseJitter:
1438+ _fFlushCursor = FPure (lw);
1439+ break ;
1440+
14211441 default :
14221442 return _FSetProp (prid, lw);
14231443 }
@@ -1454,6 +1474,10 @@ bool APPB::FGetProp(long prid, long *plw)
14541474 *plw = LwMulDivAway (_dtsToolTip, kdtimSecond, kdtsSecond);
14551475 break ;
14561476
1477+ case kpridReduceMouseJitter:
1478+ *plw = FPure (_fFlushCursor);
1479+ break ;
1480+
14571481 default :
14581482 if (!_FFindProp (prid, &prop))
14591483 return fFalse ;
0 commit comments