mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix double-click handling with gfx_asyncrender_old 0
We need to call `SDL_PumpEvents()` to ensure that we have the latest keyboard, mouse and joystick state before we use it. See: - https://wiki.libsdl.org/SDL2/SDL_GetKeyboardState - https://wiki.libsdl.org/SDL3/SDL_GetMouseState#code-examples Closes #7052.
This commit is contained in:
parent
c975c3944f
commit
98bfed7859
|
@ -557,6 +557,9 @@ int CInput::Update()
|
||||||
// keep the counter between 1..0xFFFF, 0 means not pressed
|
// keep the counter between 1..0xFFFF, 0 means not pressed
|
||||||
m_InputCounter = (m_InputCounter % 0xFFFF) + 1;
|
m_InputCounter = (m_InputCounter % 0xFFFF) + 1;
|
||||||
|
|
||||||
|
// Ensure that we have the latest keyboard, mouse and joystick state
|
||||||
|
SDL_PumpEvents();
|
||||||
|
|
||||||
int NumKeyStates;
|
int NumKeyStates;
|
||||||
const Uint8 *pState = SDL_GetKeyboardState(&NumKeyStates);
|
const Uint8 *pState = SDL_GetKeyboardState(&NumKeyStates);
|
||||||
if(NumKeyStates >= KEY_MOUSE_1)
|
if(NumKeyStates >= KEY_MOUSE_1)
|
||||||
|
|
Loading…
Reference in a new issue