Skip to content

Commit

Permalink
fix a few miscellaneous things. Still no fix for the drag bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Mar 12, 2020
1 parent fea90a7 commit b483c66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
// See Terminal::SendMouseEvent for more information.
// Arguments:
// - point: the PointerPoint object representing a mouse event from our XAML input handler
// - goingDown: true, if the button was pressed. False, if it was released.
// Mouse moved events must only be encoded as the button being pressed, not released.
bool TermControl::_TrySendMouseEvent(Windows::UI::Input::PointerPoint const& point)
{
// If the user is holding down Shift, suppress mouse events
Expand Down Expand Up @@ -993,6 +991,12 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
const auto ptr = args.Pointer();
const auto point = args.GetCurrentPoint(*this);

if (!_focused)
{
args.Handled(true);
return;
}

if (ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Mouse || ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Pen)
{
if (_TrySendMouseEvent(point))
Expand Down Expand Up @@ -1087,11 +1091,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation

if (ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Mouse || ptr.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Pen)
{
const auto modifiers = static_cast<uint32_t>(args.KeyModifiers());
// static_cast to a uint32_t because we can't use the WI_IsFlagSet
// macro directly with a VirtualKeyModifiers
const auto shiftEnabled = WI_IsFlagSet(modifiers, static_cast<uint32_t>(VirtualKeyModifiers::Shift));

if (_TrySendMouseEvent(point))
{
args.Handled(true);
Expand Down
16 changes: 8 additions & 8 deletions src/cascadia/TerminalCore/TerminalDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ CATCH_LOG_RETURN_FALSE()
bool TerminalDispatch::SetKeypadMode(const bool fApplicationMode) noexcept
{
_terminalApi.SetKeypadMode(fApplicationMode);
return false;
return true;
}

// - DECCKM - Sets the cursor keys input mode to either Application mode or Normal mode (true, false respectively)
Expand All @@ -233,7 +233,7 @@ bool TerminalDispatch::SetKeypadMode(const bool fApplicationMode) noexcept
bool TerminalDispatch::SetCursorKeysMode(const bool applicationMode) noexcept
{
_terminalApi.SetCursorKeysMode(applicationMode);
return false;
return true;
}

//Routine Description:
Expand All @@ -245,7 +245,7 @@ bool TerminalDispatch::SetCursorKeysMode(const bool applicationMode) noexcept
bool TerminalDispatch::EnableVT200MouseMode(const bool enabled) noexcept
{
_terminalApi.EnableVT200MouseMode(enabled);
return false;
return true;
}

//Routine Description:
Expand All @@ -258,7 +258,7 @@ bool TerminalDispatch::EnableVT200MouseMode(const bool enabled) noexcept
bool TerminalDispatch::EnableUTF8ExtendedMouseMode(const bool enabled) noexcept
{
_terminalApi.EnableUTF8ExtendedMouseMode(enabled);
return false;
return true;
}

//Routine Description:
Expand All @@ -271,7 +271,7 @@ bool TerminalDispatch::EnableUTF8ExtendedMouseMode(const bool enabled) noexcept
bool TerminalDispatch::EnableSGRExtendedMouseMode(const bool enabled) noexcept
{
_terminalApi.EnableSGRExtendedMouseMode(enabled);
return false;
return true;
}

//Routine Description:
Expand All @@ -283,7 +283,7 @@ bool TerminalDispatch::EnableSGRExtendedMouseMode(const bool enabled) noexcept
bool TerminalDispatch::EnableButtonEventMouseMode(const bool enabled) noexcept
{
_terminalApi.EnableButtonEventMouseMode(enabled);
return false;
return true;
}

//Routine Description:
Expand All @@ -296,7 +296,7 @@ bool TerminalDispatch::EnableButtonEventMouseMode(const bool enabled) noexcept
bool TerminalDispatch::EnableAnyEventMouseMode(const bool enabled) noexcept
{
_terminalApi.EnableAnyEventMouseMode(enabled);
return false;
return true;
}

//Routine Description:
Expand All @@ -309,7 +309,7 @@ bool TerminalDispatch::EnableAnyEventMouseMode(const bool enabled) noexcept
bool TerminalDispatch::EnableAlternateScroll(const bool enabled) noexcept
{
_terminalApi.EnableAlternateScrollMode(enabled);
return false;
return true;
}

bool TerminalDispatch::SetPrivateModes(const std::basic_string_view<DispatchTypes::PrivateModeParams> params) noexcept
Expand Down

0 comments on commit b483c66

Please sign in to comment.