mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
Fix hotkey events synching with hotkey state.
This is a semi-revert of78bc56f33eand a correct fix for #3194. The core issue is that the GUI handler must come behore the hotkey handler, otherwise typing in boxes can set off hotkeys, and the hotkey handler is repsonsible for updating the hotkey state. Thus the GUI handler never has an up-to-date hotkey state, since that's done later.78bc56f33efixed that by calling HotkeyInputHandler manually, but that was still broken in some (unused) cases and was hacky (indeed, it even looked hacky as noted by elexis). The simplest fix is to split the 'hotkey creator' handler from the 'hotkey state change' handler, and run the 'hotkey state change handler' before any other handler. Thus the gui handler remains in front of the 'hotkey creator' handler, but it has a correct hotkey state at any time. Differential Revision: https://code.wildfiregames.com/D1839 This was SVN commit r22909.
This commit is contained in:
+2
-7
@@ -87,15 +87,10 @@ InReaction CGUI::HandleEvent(const SDL_Event_* ev)
|
||||
if (it != m_HotkeyObjects.end())
|
||||
for (IGUIObject* const& obj : it->second)
|
||||
{
|
||||
// Update hotkey status before sending the event,
|
||||
// else the status will be outdated when processing the GUI event.
|
||||
HotkeyInputHandler(ev);
|
||||
ret = IN_HANDLED;
|
||||
|
||||
if (ev->ev.type == SDL_HOTKEYDOWN)
|
||||
obj->SendEvent(GUIM_PRESSED, "press");
|
||||
ret = obj->SendEvent(GUIM_PRESSED, "press");
|
||||
else
|
||||
obj->SendEvent(GUIM_RELEASED, "release");
|
||||
ret = obj->SendEvent(GUIM_RELEASED, "release");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user