mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Improve correctness of hotkeys at low framerates.
SDL queues up all the input events received in a frame. When the hotkey system saw a key up/down event, it immediately updated its HotkeyIsPressed state and then pushed a hotkey event onto the end of the queue. If the initial queue was e.g. [key-down shift, key-press Z, key-up shift], the hotkey event triggered by Z would be processed after the key-up shift had updated the HotkeyIsPressed state, so the handler of the Z hotkey would not think the shift hotkey was pressed. If the initial queue was e.g. [key-press Z, mouse-click], the hotkey triggered by Z would be processed after the mouse-click event, so it could apply to the wrong building selection. Fix by pushing the hotkey events onto a special queue that gets processed before any subsequent SDL input events. Also update the HotkeyIsPressed status when the HOTKEYDOWN/HOTKEYUP events are processed, not when they are generated, to guarantee they are consistent with the DOWN/UP events. Fixes #1869. This was SVN commit r14057.
This commit is contained in:
+1
-1
@@ -180,7 +180,7 @@ static void PumpEvents()
|
||||
PROFILE3("dispatch events");
|
||||
|
||||
SDL_Event_ ev;
|
||||
while (SDL_PollEvent(&ev.ev))
|
||||
while (in_poll_event(&ev))
|
||||
{
|
||||
PROFILE2("event");
|
||||
if (g_GUI)
|
||||
|
||||
Reference in New Issue
Block a user