mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 18:11:39 -05:00
Fix cursor being hidden when pressing modifier keys (#19473)
Closes #19445
This commit is contained in:
committed by
GitHub
parent
b8f35a31c2
commit
b357de9897
@@ -194,6 +194,22 @@ static wil::unique_mutex acquireMutexOrAttemptHandoff(const wchar_t* className,
|
||||
return {};
|
||||
}
|
||||
|
||||
static constexpr bool IsInputKey(WORD vkey) noexcept
|
||||
{
|
||||
return vkey != VK_CONTROL &&
|
||||
vkey != VK_LCONTROL &&
|
||||
vkey != VK_RCONTROL &&
|
||||
vkey != VK_MENU &&
|
||||
vkey != VK_LMENU &&
|
||||
vkey != VK_RMENU &&
|
||||
vkey != VK_SHIFT &&
|
||||
vkey != VK_LSHIFT &&
|
||||
vkey != VK_RSHIFT &&
|
||||
vkey != VK_LWIN &&
|
||||
vkey != VK_RWIN &&
|
||||
vkey != VK_SNAPSHOT;
|
||||
}
|
||||
|
||||
HWND WindowEmperor::GetMainWindow() const noexcept
|
||||
{
|
||||
_assertIsMainThread();
|
||||
@@ -485,10 +501,16 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow)
|
||||
}
|
||||
|
||||
if (msg.message == WM_KEYDOWN)
|
||||
{
|
||||
const auto vkey = static_cast<WORD>(msg.wParam);
|
||||
|
||||
// Hide the cursor only when the key pressed is an input key (ignore modifier keys).
|
||||
if (IsInputKey(vkey))
|
||||
{
|
||||
IslandWindow::HideCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IslandWindow::IsCursorHidden())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user