mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
ImguiSystem: reset keydown state properly once window closes
In commit 1fd4c25cd0188f96c7d1fe7b0a8b072763eed032, an attempt was made to fix this by calling the message handler with WM_NULL, but WM_KILLFOCUS should've been passed instead, as Dear ImGui clears the keydown state with this message. WM_NULL does nothing.
This commit is contained in:
parent
c8e8bea154
commit
77851d9ad7
@ -83,16 +83,14 @@ LRESULT CGame::ImguiWindowProc(HWND hWnd, UINT& uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
}//////////////////////////////////////////////////////////////////////////////
|
}//////////////////////////////////////////////////////////////////////////////
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_bBlockInput)
|
if (g_bBlockInput.exchange(false))
|
||||||
{
|
{
|
||||||
// Dry run with null msg to clear the event queue, we have to do this as
|
// Dry run with kill focus msg to clear the keydown state, we have to do
|
||||||
// the menu's can be closed while still holding down a key. That key will
|
// this as the menu's can be closed while still holding down a key. That
|
||||||
// remain in the event queue so the next time a window is opened, that
|
// key will remain pressed down so the next time a window is opened that
|
||||||
// key will be spammed until that particular key msg is sent here again.
|
// key will be spammed, until that particular key msg is sent here again.
|
||||||
hr = ImguiSystem()->MessageHandler(hWnd, WM_NULL, wParam, lParam);
|
hr = ImguiSystem()->MessageHandler(hWnd, WM_KILLFOCUS, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bBlockInput = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -19,7 +19,7 @@ static IShowCursor g_oShowCursor = nullptr;
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static POINT g_pLastCursorPos { 0 };
|
static POINT g_pLastCursorPos { 0 };
|
||||||
extern BOOL g_bBlockInput = false;
|
extern std::atomic_bool g_bBlockInput = false;
|
||||||
|
|
||||||
//#############################################################################
|
//#############################################################################
|
||||||
// INITIALIZATION
|
// INITIALIZATION
|
||||||
|
@ -7,6 +7,6 @@ void Input_Shutdown();
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Globals
|
// Globals
|
||||||
extern BOOL g_bBlockInput;
|
extern std::atomic_bool g_bBlockInput;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user