Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent read-only warning on mouse move, wheel and release #9107

Merged
1 commit merged into from Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/cascadia/TerminalControl/TermControl.cpp
Expand Up @@ -885,6 +885,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
// - Whether the key was handled.
bool TermControl::OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down)
{
// Short-circuit isReadOnly check to avoid warning dialog
if (_isReadOnly)
{
return false;
Expand Down Expand Up @@ -970,6 +971,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
const auto vkey = gsl::narrow_cast<WORD>(e.OriginalKey());
const auto scanCode = gsl::narrow_cast<WORD>(e.KeyStatus().ScanCode);

// Short-circuit isReadOnly check to avoid warning dialog
if (_isReadOnly)
{
e.Handled(!keyDown || _TryHandleKeyBinding(vkey, scanCode, modifiers));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey I know this isn't a part of this PR, but should this block be below the enhanced key and alt+# branches? Like move it to ~line 997? It seems like those two branches might affect the behavior of the keybinding handling

Expand Down Expand Up @@ -1369,7 +1371,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation

if (ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Mouse || ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Pen)
{
if (_focused && _CanSendVTMouseInput())
// Short-circuit isReadOnly check to avoid warning dialog
if (_focused && !_isReadOnly && _CanSendVTMouseInput())
{
_TrySendMouseEvent(point);
args.Handled(true);
Expand Down Expand Up @@ -1521,7 +1524,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation

if (ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Mouse || ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Pen)
{
if (_CanSendVTMouseInput())
// Short-circuit isReadOnly check to avoid warning dialog
if (!_isReadOnly && _CanSendVTMouseInput())
{
_TrySendMouseEvent(point);
args.Handled(true);
Expand Down Expand Up @@ -1596,7 +1600,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
const int32_t delta,
const TerminalInput::MouseButtonState state)
{
if (_CanSendVTMouseInput())
// Short-circuit isReadOnly check to avoid warning dialog
if (!_isReadOnly && _CanSendVTMouseInput())
{
// Most mouse event handlers call
// _TrySendMouseEvent(point);
Expand Down