Skip to content

Commit

Permalink
fix on-screen keyboard activation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegiacometti committed Feb 22, 2025
1 parent 74214f6 commit 7fece23
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation

if (std::find(letters.begin(), letters.end(), letterKey) != cend(letters) && m_isLanguageLetterCb(letterKey))
{
if (m_toolbarVisible && letterPressed == letterKey)
{
// On-screen keyboard continuously sends WM_KEYDOWN when a key is held down
// If Quick Accent is visible, prevent the letter key from being processed
// https://github.com/microsoft/PowerToys/issues/36853
return true;
}

m_stopwatch.reset();
letterPressed = letterKey;
}
Expand Down Expand Up @@ -220,7 +228,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
Logger::debug(L"Next toolbar position - space");
m_nextCharCb(TriggerKey::Space, m_leftShiftPressed || m_rightShiftPressed);
}

return true;
}

Expand Down Expand Up @@ -282,14 +290,14 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation

LRESULT KeyboardListener::LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION && s_instance != nullptr)
{
if (nCode == HC_ACTION && s_instance != nullptr)
KBDLLHOOKSTRUCT* key = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam);
switch (wParam)
{
KBDLLHOOKSTRUCT* key = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam);
switch (wParam)
{
case WM_KEYDOWN:
{
Logger::debug(L"Key down: {}", key->vkCode);
if (s_instance->OnKeyDown(*key))
{
return true;
Expand All @@ -304,10 +312,9 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
}
}
break;
}
}

return CallNextHookEx(NULL, nCode, wParam, lParam);
}

return CallNextHookEx(NULL, nCode, wParam, lParam);
}
}

0 comments on commit 7fece23

Please sign in to comment.