[NTUSER] Release modifier keys when deactivating message queue (#6754)

CORE-14768
This commit is contained in:
Thamatip Chitpong 2024-04-26 07:12:02 +07:00 committed by GitHub
parent 1331e2fb02
commit 018264f38f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View file

@ -341,6 +341,9 @@ IntDeactivateWindow(PTHREADINFO pti, HANDLE tid)
UserDerefObjectCo(pwndFocus);
}
/* Check for keyboard modifiers and release them (CORE-14768) */
MsqReleaseModifierKeys(pti->MessageQueue);
if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
if (ptiCurrent != pti)
{

View file

@ -2530,6 +2530,21 @@ MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
return NULL;
}
VOID FASTCALL
MsqReleaseModifierKeys(PUSER_MESSAGE_QUEUE MessageQueue)
{
WORD ModifierKeys[] = { VK_LCONTROL, VK_RCONTROL, VK_CONTROL,
VK_LMENU, VK_RMENU, VK_MENU,
VK_LSHIFT, VK_RSHIFT, VK_SHIFT };
UINT i;
for (i = 0; i < _countof(ModifierKeys); ++i)
{
if (IS_KEY_DOWN(MessageQueue->afKeyState, ModifierKeys[i]))
SET_KEY_DOWN(MessageQueue->afKeyState, ModifierKeys[i], FALSE);
}
}
SHORT
APIENTRY
NtUserGetKeyState(INT key)

View file

@ -288,4 +288,7 @@ co_IntWaitMessage( PWND Window,
UINT MsgFilterMin,
UINT MsgFilterMax );
VOID FASTCALL
MsqReleaseModifierKeys(PUSER_MESSAGE_QUEUE MessageQueue);
/* EOF */