Engine: fix imgui regression causing inputs to be stuck

Holding a key while closing the panel will keep the message in the event queue, the next time one of the windows are opened, the message will be spammed. Send a null msg to clear it properly.
This commit is contained in:
Kawe Mazidjatari 2024-11-24 00:40:44 +01:00
parent bae7df37ae
commit 1fd4c25cd0

View File

@ -62,7 +62,6 @@ LRESULT CGame::ImguiWindowProc(HWND hWnd, UINT& uMsg, WPARAM wParam, LPARAM lPar
if (g_Console.IsActivated() || g_Browser.IsActivated())
{//////////////////////////////////////////////////////////////////////////////
g_bBlockInput = true;
hr = ImguiSystem()->MessageHandler(hWnd, uMsg, wParam, lParam);
switch (uMsg)
@ -79,9 +78,20 @@ LRESULT CGame::ImguiWindowProc(HWND hWnd, UINT& uMsg, WPARAM wParam, LPARAM lPar
default:
break;
}
g_bBlockInput = true;
}//////////////////////////////////////////////////////////////////////////////
else
{
if (g_bBlockInput)
{
// Dry run with null msg to clear the event queue, we have to do this as
// the menu's can be closed while still holding down a key. That key will
// remain in the event queue so the next time a window is opened, that
// key will be spammed until that particular key msg is sent here again.
hr = ImguiSystem()->MessageHandler(hWnd, WM_NULL, wParam, lParam);
}
g_bBlockInput = false;
}