@@ -169,6 +169,14 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
169
169
170
170
if (std::find (letters.begin (), letters.end (), letterKey) != cend (letters) && m_isLanguageLetterCb (letterKey))
171
171
{
172
+ if (m_toolbarVisible && letterPressed == letterKey)
173
+ {
174
+ // On-screen keyboard continuously sends WM_KEYDOWN when a key is held down
175
+ // If Quick Accent is visible, prevent the letter key from being processed
176
+ // https://github.com/microsoft/PowerToys/issues/36853
177
+ return true ;
178
+ }
179
+
172
180
m_stopwatch.reset ();
173
181
letterPressed = letterKey;
174
182
}
@@ -220,7 +228,7 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
220
228
Logger::debug (L" Next toolbar position - space" );
221
229
m_nextCharCb (TriggerKey::Space, m_leftShiftPressed || m_rightShiftPressed);
222
230
}
223
-
231
+
224
232
return true ;
225
233
}
226
234
@@ -282,14 +290,14 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
282
290
283
291
LRESULT KeyboardListener::LowLevelKeyboardProc (int nCode, WPARAM wParam, LPARAM lParam)
284
292
{
293
+ if (nCode == HC_ACTION && s_instance != nullptr )
285
294
{
286
- if (nCode == HC_ACTION && s_instance != nullptr )
295
+ KBDLLHOOKSTRUCT* key = reinterpret_cast <KBDLLHOOKSTRUCT*>(lParam);
296
+ switch (wParam)
287
297
{
288
- KBDLLHOOKSTRUCT* key = reinterpret_cast <KBDLLHOOKSTRUCT*>(lParam);
289
- switch (wParam)
290
- {
291
298
case WM_KEYDOWN:
292
299
{
300
+ Logger::debug (L" Key down: {}" , key->vkCode );
293
301
if (s_instance->OnKeyDown (*key))
294
302
{
295
303
return true ;
@@ -304,10 +312,9 @@ namespace winrt::PowerToys::PowerAccentKeyboardService::implementation
304
312
}
305
313
}
306
314
break ;
307
- }
308
315
}
309
-
310
- return CallNextHookEx (NULL , nCode, wParam, lParam);
311
316
}
317
+
318
+ return CallNextHookEx (NULL , nCode, wParam, lParam);
312
319
}
313
320
}
0 commit comments