From 4f5621e7d06dd757ef13c5c6e4f1cddf8a49950c Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 2 Jul 2020 11:56:56 -0700 Subject: [PATCH 1/7] pass mouse button state into HandleMouse --- src/cascadia/TerminalControl/TermControl.cpp | 2 +- src/cascadia/TerminalCore/ITerminalInput.hpp | 2 +- src/cascadia/TerminalCore/Terminal.cpp | 4 ++-- src/cascadia/TerminalCore/Terminal.hpp | 2 +- src/interactivity/win32/windowio.cpp | 10 +++++++- src/terminal/input/mouseInput.cpp | 24 +++++++++----------- src/terminal/input/terminalInput.hpp | 17 ++++++++++++-- 7 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 0a73fab2e82..799a34bef19 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -997,7 +997,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } const auto modifiers = _GetPressedModifierKeys(); - return _terminal->SendMouseEvent(terminalPosition, uiButton, modifiers, sWheelDelta); + return _terminal->SendMouseEvent(terminalPosition, uiButton, modifiers, sWheelDelta, { props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }); } // Method Description: diff --git a/src/cascadia/TerminalCore/ITerminalInput.hpp b/src/cascadia/TerminalCore/ITerminalInput.hpp index 1d9785e4ee6..307f03b1165 100644 --- a/src/cascadia/TerminalCore/ITerminalInput.hpp +++ b/src/cascadia/TerminalCore/ITerminalInput.hpp @@ -17,7 +17,7 @@ namespace Microsoft::Terminal::Core ITerminalInput& operator=(ITerminalInput&&) = default; virtual bool SendKeyEvent(const WORD vkey, const WORD scanCode, const ControlKeyStates states, const bool keyDown) = 0; - virtual bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta) = 0; + virtual bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) = 0; virtual bool SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) = 0; // void SendMouseEvent(uint row, uint col, KeyModifiers modifiers); diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index f620d82779b..0a488864f0a 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -483,7 +483,7 @@ bool Terminal::SendKeyEvent(const WORD vkey, // Return Value: // - true if we translated the key event, and it should not be processed any further. // - false if we did not translate the key, and it should be processed into a character. -bool Terminal::SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta) +bool Terminal::SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const TerminalInput::MouseButtonState state) { // viewportPos must be within the dimensions of the viewport const auto viewportDimensions = _mutableViewport.Dimensions(); @@ -492,7 +492,7 @@ bool Terminal::SendMouseEvent(const COORD viewportPos, const unsigned int uiButt return false; } - return _terminalInput->HandleMouse(viewportPos, uiButton, GET_KEYSTATE_WPARAM(states.Value()), wheelDelta); + return _terminalInput->HandleMouse(viewportPos, uiButton, GET_KEYSTATE_WPARAM(states.Value()), wheelDelta, state); } // Method Description: diff --git a/src/cascadia/TerminalCore/Terminal.hpp b/src/cascadia/TerminalCore/Terminal.hpp index f7a19148a7c..d0e9204c254 100644 --- a/src/cascadia/TerminalCore/Terminal.hpp +++ b/src/cascadia/TerminalCore/Terminal.hpp @@ -114,7 +114,7 @@ class Microsoft::Terminal::Core::Terminal final : #pragma region ITerminalInput // These methods are defined in Terminal.cpp bool SendKeyEvent(const WORD vkey, const WORD scanCode, const Microsoft::Terminal::Core::ControlKeyStates states, const bool keyDown) override; - bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta) override; + bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state = {}) override; bool SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) override; [[nodiscard]] HRESULT UserResize(const COORD viewportSize) noexcept override; diff --git a/src/interactivity/win32/windowio.cpp b/src/interactivity/win32/windowio.cpp index ba3b0385b74..1f83748e198 100644 --- a/src/interactivity/win32/windowio.cpp +++ b/src/interactivity/win32/windowio.cpp @@ -123,7 +123,15 @@ bool HandleTerminalMouseEvent(const COORD cMousePosition, // Virtual terminal input mode if (IsInVirtualTerminalInputMode()) { - fWasHandled = gci.GetActiveInputBuffer()->GetTerminalInput().HandleMouse(cMousePosition, uiButton, sModifierKeystate, sWheelDelta); + using namespace Microsoft::Console::VirtualTerminal; + + TerminalInput::MouseButtonState state { + WI_IsFlagSet(GetKeyState(VK_LBUTTON), TerminalInput::KeyPressed), + WI_IsFlagSet(GetKeyState(VK_MBUTTON), TerminalInput::KeyPressed), + WI_IsFlagSet(GetKeyState(VK_RBUTTON), TerminalInput::KeyPressed) + }; + + fWasHandled = gci.GetActiveInputBuffer()->GetTerminalInput().HandleMouse(cMousePosition, uiButton, sModifierKeystate, sWheelDelta, state); } return fWasHandled; diff --git a/src/terminal/input/mouseInput.cpp b/src/terminal/input/mouseInput.cpp index c215c810146..6751e424939 100644 --- a/src/terminal/input/mouseInput.cpp +++ b/src/terminal/input/mouseInput.cpp @@ -12,10 +12,6 @@ using namespace Microsoft::Console::VirtualTerminal; #endif static const int s_MaxDefaultCoordinate = 94; -// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx -// "If the high-order bit is 1, the key is down; otherwise, it is up." -static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; - // Alternate scroll sequences static constexpr std::wstring_view CursorUpSequence{ L"\x1b[A" }; static constexpr std::wstring_view CursorDownSequence{ L"\x1b[B" }; @@ -93,22 +89,22 @@ static constexpr bool _isButtonDown(const unsigned int button) noexcept // - Retrieves which mouse button is currently pressed. This is needed because // MOUSEMOVE events do not also tell us if any mouse buttons are pressed during the move. // Parameters: -// +// - state - the current state of which mouse buttons are pressed // Return value: // - a button corresponding to any pressed mouse buttons, else WM_LBUTTONUP if none are pressed. -unsigned int TerminalInput::s_GetPressedButton() noexcept +unsigned int TerminalInput::s_GetPressedButton(const MouseButtonState state) noexcept { - // TODO GH#4869: Have the caller pass the mouse button state into HandleMouse - unsigned int button = WM_LBUTTONUP; // Will be treated as a release, or no button pressed. - if (WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed)) + // Will be treated as a release, or no button pressed. + unsigned int button = WM_LBUTTONUP; + if (state.isLeftButtonDown) { button = WM_LBUTTONDOWN; } - else if (WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed)) + else if (state.isMiddleButtonDown) { button = WM_MBUTTONDOWN; } - else if (WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed)) + else if (state.isRightButtonDown) { button = WM_RBUTTONDOWN; } @@ -286,12 +282,14 @@ bool TerminalInput::IsTrackingMouseInput() const noexcept // - button - the message to decode. // - modifierKeyState - the modifier keys pressed with this button // - delta - the amount that the scroll wheel changed (should be 0 unless button is a WM_MOUSE*WHEEL) +// - state - the state of the mouse buttons at this moment // Return value: // - true if the event was handled and we should stop event propagation to the default window handler. bool TerminalInput::HandleMouse(const COORD position, const unsigned int button, const short modifierKeyState, - const short delta) + const short delta, + const MouseButtonState state) { bool success = false; if (_ShouldSendAlternateScroll(button, delta)) @@ -316,7 +314,7 @@ bool TerminalInput::HandleMouse(const COORD position, // _GetPressedButton will return the first pressed mouse button. // If it returns WM_LBUTTONUP, then we can assume that the mouse // moved without a button being pressed. - const unsigned int realButton = isHover ? s_GetPressedButton() : button; + const unsigned int realButton = isHover ? s_GetPressedButton(state) : button; // In default mode, only button presses/releases are sent // In ButtonEvent mode, changing coord hovers WITH A BUTTON PRESSED diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 7b2d9abf0a5..8fe2b5414b2 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -43,10 +43,23 @@ namespace Microsoft::Console::VirtualTerminal #pragma region MouseInput // These methods are defined in mouseInput.cpp + + // This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx + // "If the high-order bit is 1, the key is down; otherwise, it is up." + static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + + struct MouseButtonState + { + bool isLeftButtonDown; + bool isMiddleButtonDown; + bool isRightButtonDown; + }; + bool HandleMouse(const COORD position, const unsigned int button, const short modifierKeyState, - const short delta); + const short delta, + const MouseButtonState state); bool IsTrackingMouseInput() const noexcept; #pragma endregion @@ -135,7 +148,7 @@ namespace Microsoft::Console::VirtualTerminal bool _ShouldSendAlternateScroll(const unsigned int button, const short delta) const noexcept; bool _SendAlternateScroll(const short delta) const noexcept; - static unsigned int s_GetPressedButton() noexcept; + static unsigned int s_GetPressedButton(const MouseButtonState state) noexcept; #pragma endregion }; } From c64f1c04cf51c3f23a6eb9337b4544467d0fdd6a Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 7 Jul 2020 11:15:25 -0700 Subject: [PATCH 2/7] test fixes and pr comments --- src/cascadia/TerminalControl/TermControl.cpp | 3 +- src/interactivity/win32/windowio.cpp | 15 +++-- .../adapter/ut_adapter/MouseInputTest.cpp | 55 +++++++++++-------- src/terminal/input/terminalInput.hpp | 4 -- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 799a34bef19..bf30a153141 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -997,7 +997,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } const auto modifiers = _GetPressedModifierKeys(); - return _terminal->SendMouseEvent(terminalPosition, uiButton, modifiers, sWheelDelta, { props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }); + const ::Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state{ props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }; + return _terminal->SendMouseEvent(terminalPosition, uiButton, modifiers, sWheelDelta, state); } // Method Description: diff --git a/src/interactivity/win32/windowio.cpp b/src/interactivity/win32/windowio.cpp index 1f83748e198..1fd5a766e15 100644 --- a/src/interactivity/win32/windowio.cpp +++ b/src/interactivity/win32/windowio.cpp @@ -23,12 +23,17 @@ #pragma hdrstop using namespace Microsoft::Console::Interactivity::Win32; +using namespace Microsoft::Console::VirtualTerminal; using Microsoft::Console::Interactivity::ServiceLocator; // For usage with WM_SYSKEYDOWN message processing. // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms646286(v=vs.85).aspx // Bit 29 is whether ALT was held when the message was posted. #define WM_SYSKEYDOWN_ALT_PRESSED (0x20000000) +// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx +// "If the high-order bit is 1, the key is down; otherwise, it is up." +static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + // ---------------------------- // Helpers // ---------------------------- @@ -123,12 +128,10 @@ bool HandleTerminalMouseEvent(const COORD cMousePosition, // Virtual terminal input mode if (IsInVirtualTerminalInputMode()) { - using namespace Microsoft::Console::VirtualTerminal; - - TerminalInput::MouseButtonState state { - WI_IsFlagSet(GetKeyState(VK_LBUTTON), TerminalInput::KeyPressed), - WI_IsFlagSet(GetKeyState(VK_MBUTTON), TerminalInput::KeyPressed), - WI_IsFlagSet(GetKeyState(VK_RBUTTON), TerminalInput::KeyPressed) + TerminalInput::MouseButtonState state{ + WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed), + WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed), + WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed) }; fWasHandled = gci.GetActiveInputBuffer()->GetTerminalInput().HandleMouse(cMousePosition, uiButton, sModifierKeystate, sWheelDelta, state); diff --git a/src/terminal/adapter/ut_adapter/MouseInputTest.cpp b/src/terminal/adapter/ut_adapter/MouseInputTest.cpp index e740467cc5a..6f41668a002 100644 --- a/src/terminal/adapter/ut_adapter/MouseInputTest.cpp +++ b/src/terminal/adapter/ut_adapter/MouseInputTest.cpp @@ -292,7 +292,7 @@ class MouseInputTest bool fExpectedKeyHandled = false; s_pwszInputExpected = L"\x0"; - VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta)); + VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta, {})); mouseInput->EnableDefaultTracking(true); @@ -309,7 +309,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -327,7 +328,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -345,7 +347,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } } @@ -371,7 +374,7 @@ class MouseInputTest bool fExpectedKeyHandled = false; s_pwszInputExpected = L"\x0"; - VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta)); + VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta, {})); mouseInput->SetUtf8ExtendedMode(true); @@ -391,7 +394,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -409,7 +413,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -427,7 +432,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } } @@ -453,7 +459,7 @@ class MouseInputTest bool fExpectedKeyHandled = false; s_pwszInputExpected = L"\x0"; - VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta)); + VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta, {})); mouseInput->SetSGRExtendedMode(true); @@ -471,7 +477,7 @@ class MouseInputTest // validate translation VERIFY_ARE_EQUAL(fExpectedKeyHandled, - mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, sScrollDelta), + mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, sScrollDelta, {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -488,7 +494,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -506,7 +513,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } } @@ -532,7 +540,7 @@ class MouseInputTest bool fExpectedKeyHandled = false; s_pwszInputExpected = L"\x0"; - VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta)); + VERIFY_ARE_EQUAL(fExpectedKeyHandled, mouseInput->HandleMouse({ 0, 0 }, uiButton, sModifierKeystate, sScrollDelta, {})); // Default Tracking, Default Encoding mouseInput->EnableDefaultTracking(true); @@ -550,7 +558,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -570,7 +579,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } @@ -589,7 +599,8 @@ class MouseInputTest mouseInput->HandleMouse(Coord, uiButton, sModifierKeystate, - sScrollDelta), + sScrollDelta, + {}), NoThrowString().Format(L"(x,y)=(%d,%d)", Coord.X, Coord.Y)); } } @@ -606,31 +617,31 @@ class MouseInputTest Log::Comment(L"Test mouse wheel scrolling up"); s_pwszInputExpected = L"\x1B[A"; - VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1)); + VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1, {})); Log::Comment(L"Test mouse wheel scrolling down"); s_pwszInputExpected = L"\x1B[B"; - VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, -1)); + VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, -1, {})); Log::Comment(L"Enable cursor keys mode"); mouseInput->ChangeCursorKeysMode(true); Log::Comment(L"Test mouse wheel scrolling up"); s_pwszInputExpected = L"\x1BOA"; - VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1)); + VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1, {})); Log::Comment(L"Test mouse wheel scrolling down"); s_pwszInputExpected = L"\x1BOB"; - VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, -1)); + VERIFY_IS_TRUE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, -1, {})); Log::Comment(L"Confirm no effect when scroll mode is disabled"); mouseInput->UseAlternateScreenBuffer(); mouseInput->EnableAlternateScroll(false); - VERIFY_IS_FALSE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1)); + VERIFY_IS_FALSE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1, {})); Log::Comment(L"Confirm no effect when using the main buffer"); mouseInput->UseMainScreenBuffer(); mouseInput->EnableAlternateScroll(true); - VERIFY_IS_FALSE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1)); + VERIFY_IS_FALSE(mouseInput->HandleMouse({ 0, 0 }, WM_MOUSEWHEEL, noModifierKeys, 1, {})); } }; diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 8fe2b5414b2..50ad3bd991a 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -44,10 +44,6 @@ namespace Microsoft::Console::VirtualTerminal #pragma region MouseInput // These methods are defined in mouseInput.cpp - // This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx - // "If the high-order bit is 1, the key is down; otherwise, it is up." - static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; - struct MouseButtonState { bool isLeftButtonDown; From d8734abdc5aac38d45eae28ad07f7424899fa8b4 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 9 Jul 2020 12:09:50 -0700 Subject: [PATCH 3/7] remove default param --- src/cascadia/PublicTerminalCore/HwndTerminal.cpp | 2 +- src/cascadia/TerminalControl/TermControl.cpp | 3 ++- src/cascadia/TerminalCore/Terminal.hpp | 2 +- src/terminal/input/mouseInput.cpp | 2 +- src/terminal/input/terminalInput.hpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index cb31e1860f3..95db23b674a 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -553,7 +553,7 @@ try wheelDelta = HIWORD(wParam); } - return _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta); + return _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta, {}); } catch (...) { diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index bf30a153141..530e7894258 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1360,7 +1360,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation return _terminal->SendMouseEvent(_GetTerminalPosition(point), WM_MOUSEWHEEL, _GetPressedModifierKeys(), - ::base::saturated_cast(delta)); + ::base::saturated_cast(delta), + {}); } const auto ctrlPressed = modifiers.IsCtrlPressed(); diff --git a/src/cascadia/TerminalCore/Terminal.hpp b/src/cascadia/TerminalCore/Terminal.hpp index d0e9204c254..bcffa12dfa6 100644 --- a/src/cascadia/TerminalCore/Terminal.hpp +++ b/src/cascadia/TerminalCore/Terminal.hpp @@ -114,7 +114,7 @@ class Microsoft::Terminal::Core::Terminal final : #pragma region ITerminalInput // These methods are defined in Terminal.cpp bool SendKeyEvent(const WORD vkey, const WORD scanCode, const Microsoft::Terminal::Core::ControlKeyStates states, const bool keyDown) override; - bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state = {}) override; + bool SendMouseEvent(const COORD viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) override; bool SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) override; [[nodiscard]] HRESULT UserResize(const COORD viewportSize) noexcept override; diff --git a/src/terminal/input/mouseInput.cpp b/src/terminal/input/mouseInput.cpp index 6751e424939..600de0c2b83 100644 --- a/src/terminal/input/mouseInput.cpp +++ b/src/terminal/input/mouseInput.cpp @@ -92,7 +92,7 @@ static constexpr bool _isButtonDown(const unsigned int button) noexcept // - state - the current state of which mouse buttons are pressed // Return value: // - a button corresponding to any pressed mouse buttons, else WM_LBUTTONUP if none are pressed. -unsigned int TerminalInput::s_GetPressedButton(const MouseButtonState state) noexcept +constexpr unsigned int TerminalInput::s_GetPressedButton(const MouseButtonState state) noexcept { // Will be treated as a release, or no button pressed. unsigned int button = WM_LBUTTONUP; diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 50ad3bd991a..df2a6603f27 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -144,7 +144,7 @@ namespace Microsoft::Console::VirtualTerminal bool _ShouldSendAlternateScroll(const unsigned int button, const short delta) const noexcept; bool _SendAlternateScroll(const short delta) const noexcept; - static unsigned int s_GetPressedButton(const MouseButtonState state) noexcept; + static constexpr unsigned int s_GetPressedButton(const MouseButtonState state) noexcept; #pragma endregion }; } From 420606362a55634330ac93eb757d7a95e31c0526 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 9 Jul 2020 16:05:37 -0700 Subject: [PATCH 4/7] record state when scrolling --- .../TerminalControl/IMouseWheelListener.idl | 2 +- src/cascadia/TerminalControl/TermControl.cpp | 19 +++++++++++++------ src/cascadia/TerminalControl/TermControl.h | 4 ++-- src/cascadia/WindowsTerminal/AppHost.cpp | 10 +++++++++- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalControl/IMouseWheelListener.idl b/src/cascadia/TerminalControl/IMouseWheelListener.idl index 63089552683..8ba8284b5d4 100644 --- a/src/cascadia/TerminalControl/IMouseWheelListener.idl +++ b/src/cascadia/TerminalControl/IMouseWheelListener.idl @@ -11,6 +11,6 @@ namespace Microsoft.Terminal.TerminalControl [uuid("65b8b8c5-988f-43ff-aba9-e89368da1598")] interface IMouseWheelListener { - Boolean OnMouseWheel(Windows.Foundation.Point coord, Int32 delta); + Boolean OnMouseWheel(Windows.Foundation.Point coord, Int32 delta, Boolean leftButtonDown, Boolean midButtonDown, Boolean rightButtonDown); } } diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 530e7894258..d1d95076374 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -16,6 +16,7 @@ #include "TermControlAutomationPeer.h" using namespace ::Microsoft::Console::Types; +using namespace ::Microsoft::Console::VirtualTerminal; using namespace ::Microsoft::Terminal::Core; using namespace winrt::Windows::UI::Xaml; using namespace winrt::Windows::UI::Xaml::Input; @@ -997,7 +998,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } const auto modifiers = _GetPressedModifierKeys(); - const ::Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state{ props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }; + const TerminalInput::MouseButtonState state{ props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }; return _terminal->SendMouseEvent(terminalPosition, uiButton, modifiers, sWheelDelta, state); } @@ -1322,10 +1323,12 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } const auto point = args.GetCurrentPoint(*this); + const auto props = point.Properties(); + const TerminalInput::MouseButtonState state{ props.IsLeftButtonPressed(), props.IsMiddleButtonPressed(), props.IsRightButtonPressed() }; auto result = _DoMouseWheel(point.Position(), ControlKeyStates{ args.KeyModifiers() }, point.Properties().MouseWheelDelta(), - point.Properties().IsLeftButtonPressed()); + state); if (result) { args.Handled(true); @@ -1348,7 +1351,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation bool TermControl::_DoMouseWheel(const Windows::Foundation::Point point, const ControlKeyStates modifiers, const int32_t delta, - const bool isLeftButtonPressed) + const TerminalInput::MouseButtonState state) { if (_CanSendVTMouseInput()) { @@ -1377,7 +1380,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } else { - _MouseScrollHandler(delta, point, isLeftButtonPressed); + _MouseScrollHandler(delta, point, state.isLeftButtonDown); } return false; } @@ -1392,10 +1395,14 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // relative to the origin of the control // - delta: the mouse wheel delta that triggered this event. bool TermControl::OnMouseWheel(const Windows::Foundation::Point location, - const int32_t delta) + const int32_t delta, + const bool leftButtonDown, + const bool midButtonDown, + const bool rightButtonDown) { const auto modifiers = _GetPressedModifierKeys(); - return _DoMouseWheel(location, modifiers, delta, false); + TerminalInput::MouseButtonState state{ leftButtonDown, midButtonDown, rightButtonDown }; + return _DoMouseWheel(location, modifiers, delta, state); } // Method Description: diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index d8ccbb2fab3..bb9a706d76d 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -87,7 +87,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation bool OnDirectKeyEvent(const uint32_t vkey, const bool down); - bool OnMouseWheel(const Windows::Foundation::Point location, const int32_t delta); + bool OnMouseWheel(const Windows::Foundation::Point location, const int32_t delta, const bool leftButtonDown, const bool midButtonDown, const bool rightButtonDown); ~TermControl(); @@ -218,7 +218,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation void _MouseScrollHandler(const double mouseDelta, const Windows::Foundation::Point point, const bool isLeftButtonPressed); void _MouseZoomHandler(const double delta); void _MouseTransparencyHandler(const double delta); - bool _DoMouseWheel(const Windows::Foundation::Point point, const ::Microsoft::Terminal::Core::ControlKeyStates modifiers, const int32_t delta, const bool isLeftButtonPressed); + bool _DoMouseWheel(const Windows::Foundation::Point point, const ::Microsoft::Terminal::Core::ControlKeyStates modifiers, const int32_t delta, const ::Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state); bool _CapturePointer(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e); bool _ReleasePointerCapture(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e); diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index b88a21cd9e0..1a53a1f6c2b 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -17,6 +17,10 @@ using namespace winrt::Windows::Foundation::Numerics; using namespace ::Microsoft::Console; using namespace ::Microsoft::Console::Types; +// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx +// "If the high-order bit is 1, the key is down; otherwise, it is up." +static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + AppHost::AppHost() noexcept : _app{}, _logic{ nullptr }, // don't make one, we're going to take a ref on app's @@ -390,7 +394,11 @@ void AppHost::_WindowMouseWheeled(const til::point coord, const int32_t delta) const til::point offsetPoint = coord - controlOrigin; - if (control.OnMouseWheel(offsetPoint, delta)) + const auto lBtnDown = WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed); + const auto mBtnDown = WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed); + const auto rBtnDown = WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed); + + if (control.OnMouseWheel(offsetPoint, delta, lBtnDown, mBtnDown, rBtnDown)) { // If the element handled the mouse wheel event, don't // continue to iterate over the remaining controls. From 6803849f5358fbad4b56ea29b98d044be55a5124 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Fri, 17 Jul 2020 15:04:14 -0700 Subject: [PATCH 5/7] actually pass it in in WPF Control --- src/cascadia/PublicTerminalCore/HwndTerminal.cpp | 8 +++++++- src/cascadia/TerminalControl/TermControl.cpp | 3 ++- src/cascadia/TerminalControl/TermControl.h | 5 +++++ src/cascadia/WindowsTerminal/AppHost.cpp | 9 +++++---- src/interactivity/win32/windowio.cpp | 4 ---- src/terminal/input/terminalInput.hpp | 4 ++++ 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index d6295f2c971..57f91925abe 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -553,7 +553,13 @@ try wheelDelta = HIWORD(wParam); } - return _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta, {}); + TerminalInput::MouseButtonState state{ + WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed), + WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed), + WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed) + }; + + return _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta, state); } catch (...) { diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 72bd9ce547c..b7366cac535 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1368,7 +1368,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation WM_MOUSEWHEEL, _GetPressedModifierKeys(), ::base::saturated_cast(delta), - {}); + state); } const auto ctrlPressed = modifiers.IsCtrlPressed(); @@ -1398,6 +1398,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - location: the location of the mouse during this event. This location is // relative to the origin of the control // - delta: the mouse wheel delta that triggered this event. + // - state: the state for each of the mouse buttons (pressed/unpressed) bool TermControl::OnMouseWheel(const Windows::Foundation::Point location, const int32_t delta, const bool leftButtonDown, diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 028bc241307..a56fdb3eff6 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -17,6 +17,11 @@ #include "SearchBoxControl.h" #include "ThrottledFunc.h" +namespace Microsoft::Console::VirtualTerminal +{ + struct MouseButtonState; +} + namespace winrt::Microsoft::Terminal::TerminalControl::implementation { struct CopyToClipboardEventArgs : diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index 1160689f2f2..631d4fa1b54 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -409,11 +409,12 @@ void AppHost::_WindowMouseWheeled(const til::point coord, const int32_t delta) const til::point offsetPoint = coord - controlOrigin; - const auto lBtnDown = WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed); - const auto mBtnDown = WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed); - const auto rBtnDown = WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed); + + const auto lButtonDown = WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed); + const auto mButtonDown = WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed); + const auto rButtonDown = WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed); - if (control.OnMouseWheel(offsetPoint, delta, lBtnDown, mBtnDown, rBtnDown)) + if (control.OnMouseWheel(offsetPoint, delta, lButtonDown, mButtonDown, rButtonDown)) { // If the element handled the mouse wheel event, don't // continue to iterate over the remaining controls. diff --git a/src/interactivity/win32/windowio.cpp b/src/interactivity/win32/windowio.cpp index 8427de26d9d..0145386838c 100644 --- a/src/interactivity/win32/windowio.cpp +++ b/src/interactivity/win32/windowio.cpp @@ -30,10 +30,6 @@ using Microsoft::Console::Interactivity::ServiceLocator; // Bit 29 is whether ALT was held when the message was posted. #define WM_SYSKEYDOWN_ALT_PRESSED (0x20000000) -// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx -// "If the high-order bit is 1, the key is down; otherwise, it is up." -static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; - // ---------------------------- // Helpers // ---------------------------- diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 0405ecca36b..88db113b0e9 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -17,6 +17,10 @@ Author(s): #include "../../types/inc/IInputEvent.hpp" #pragma once +// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx +// "If the high-order bit is 1, the key is down; otherwise, it is up." +static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + namespace Microsoft::Console::VirtualTerminal { class TerminalInput final From c6e45085c36f4146d0230bdd440e26b0e856eb61 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Fri, 17 Jul 2020 16:04:19 -0700 Subject: [PATCH 6/7] format le code --- src/cascadia/WindowsTerminal/AppHost.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cascadia/WindowsTerminal/AppHost.cpp b/src/cascadia/WindowsTerminal/AppHost.cpp index 631d4fa1b54..d9e1b4bb70d 100644 --- a/src/cascadia/WindowsTerminal/AppHost.cpp +++ b/src/cascadia/WindowsTerminal/AppHost.cpp @@ -409,7 +409,6 @@ void AppHost::_WindowMouseWheeled(const til::point coord, const int32_t delta) const til::point offsetPoint = coord - controlOrigin; - const auto lButtonDown = WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed); const auto mButtonDown = WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed); const auto rButtonDown = WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed); From e04d626ff8250f3cc0f3543ba71deb646cb845ac Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 21 Jul 2020 09:36:08 -0400 Subject: [PATCH 7/7] move KeyPressed out of TermInput --- src/cascadia/PublicTerminalCore/HwndTerminal.cpp | 6 +++++- src/cascadia/TerminalControl/TermControl.cpp | 2 +- src/interactivity/win32/windowio.cpp | 6 +++++- src/terminal/input/terminalInput.hpp | 4 ---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 57f91925abe..93a506fb9b7 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -16,6 +16,10 @@ using namespace ::Microsoft::Terminal::Core; static LPCWSTR term_window_class = L"HwndTerminalClass"; +// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx +// "If the high-order bit is 1, the key is down; otherwise, it is up." +static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + static constexpr bool _IsMouseMessage(UINT uMsg) { return uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP || uMsg == WM_LBUTTONDBLCLK || @@ -553,7 +557,7 @@ try wheelDelta = HIWORD(wParam); } - TerminalInput::MouseButtonState state{ + const TerminalInput::MouseButtonState state{ WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed), WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed), WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index b7366cac535..a8cc05006f4 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1398,7 +1398,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - location: the location of the mouse during this event. This location is // relative to the origin of the control // - delta: the mouse wheel delta that triggered this event. - // - state: the state for each of the mouse buttons (pressed/unpressed) + // - state: the state for each of the mouse buttons individually (pressed/unpressed) bool TermControl::OnMouseWheel(const Windows::Foundation::Point location, const int32_t delta, const bool leftButtonDown, diff --git a/src/interactivity/win32/windowio.cpp b/src/interactivity/win32/windowio.cpp index 0145386838c..e37477de5c3 100644 --- a/src/interactivity/win32/windowio.cpp +++ b/src/interactivity/win32/windowio.cpp @@ -30,6 +30,10 @@ using Microsoft::Console::Interactivity::ServiceLocator; // Bit 29 is whether ALT was held when the message was posted. #define WM_SYSKEYDOWN_ALT_PRESSED (0x20000000) +// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx +// "If the high-order bit is 1, the key is down; otherwise, it is up." +static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; + // ---------------------------- // Helpers // ---------------------------- @@ -124,7 +128,7 @@ bool HandleTerminalMouseEvent(const COORD cMousePosition, // Virtual terminal input mode if (IsInVirtualTerminalInputMode()) { - TerminalInput::MouseButtonState state{ + const TerminalInput::MouseButtonState state{ WI_IsFlagSet(GetKeyState(VK_LBUTTON), KeyPressed), WI_IsFlagSet(GetKeyState(VK_MBUTTON), KeyPressed), WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed) diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 88db113b0e9..0405ecca36b 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -17,10 +17,6 @@ Author(s): #include "../../types/inc/IInputEvent.hpp" #pragma once -// This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx -// "If the high-order bit is 1, the key is down; otherwise, it is up." -static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; - namespace Microsoft::Console::VirtualTerminal { class TerminalInput final