@@ -89,24 +89,14 @@ static bool operator==(const Ss3ToVkey& pair, const Ss3ActionCodes code) noexcep
89
89
return pair.action == code;
90
90
}
91
91
92
- InputStateMachineEngine::InputStateMachineEngine (std::unique_ptr<IInteractDispatch> pDispatch, std::function< void ()> capturedCPR ) :
93
- _pDispatch{ std::move (pDispatch) } ,
94
- _capturedCPR{ std::move (capturedCPR) } ,
95
- _doubleClickTime{ std::chrono::milliseconds (GetDoubleClickTime ()) }
92
+ InputStateMachineEngine::InputStateMachineEngine (std::unique_ptr<IInteractDispatch> pDispatch, const bool lookingForDSR ) :
93
+ _pDispatch( std::move(pDispatch)) ,
94
+ _lookingForDSR(lookingForDSR) ,
95
+ _doubleClickTime( std::chrono::milliseconds(GetDoubleClickTime()))
96
96
{
97
97
THROW_HR_IF_NULL (E_INVALIDARG, _pDispatch.get ());
98
98
}
99
99
100
- IInteractDispatch& InputStateMachineEngine::GetDispatch () const noexcept
101
- {
102
- return *_pDispatch.get ();
103
- }
104
-
105
- void InputStateMachineEngine::CaptureNextCPR () noexcept
106
- {
107
- _lookingForCPR = true ;
108
- }
109
-
110
100
til::enumset<DeviceAttribute, uint64_t > InputStateMachineEngine::WaitUntilDA1 (DWORD timeout) const noexcept
111
101
{
112
102
uint64_t val = 0 ;
@@ -423,19 +413,13 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
423
413
// The F3 case is special - it shares a code with the DeviceStatusResponse.
424
414
// If we're looking for that response, then do that, and break out.
425
415
// Else, fall though to the _GetCursorKeysModifierState handler.
426
- if (_lookingForCPR )
416
+ if (_lookingForDSR )
427
417
{
428
- _lookingForCPR = false ;
429
- _capturedCPR ();
430
-
431
- const auto y = parameters.at (0 ).value ();
432
- const auto x = parameters.at (1 ).value ();
433
-
434
- if (y > 0 && x > 0 )
435
- {
436
- _pDispatch->MoveCursor (y, x);
437
- return true ;
438
- }
418
+ _pDispatch->MoveCursor (parameters.at (0 ), parameters.at (1 ));
419
+ // Right now we're only looking for on initial cursor
420
+ // position response. After that, only look for F3.
421
+ _lookingForDSR = false ;
422
+ return true ;
439
423
}
440
424
// Heuristic: If the hosting terminal used the win32 input mode, chances are high
441
425
// that this is a CPR requested by the terminal application as opposed to a F3 key.
@@ -507,6 +491,10 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
507
491
508
492
_deviceAttributes.fetch_or (attributes.bits (), std::memory_order_relaxed);
509
493
til::atomic_notify_all (_deviceAttributes);
494
+
495
+ // VtIo first sends a DSR CPR and then a DA1 request.
496
+ // If we encountered a DA1 response here, the DSR request is definitely done now.
497
+ _lookingForDSR = false ;
510
498
return true ;
511
499
}
512
500
return false ;
0 commit comments