Fix #1736: on GNU/Linux, a hotkey can trigger multiple commands
SDL_TEXTINPUT events aren't generated on Windows when Alt is held down.
Let's ensure that the behavior is the same on all platforms.
(cherry-picked from commit c42401a8de
)
This commit is contained in:
parent
9bcb4bbf35
commit
a01cde437a
1 changed files with 9 additions and 0 deletions
|
@ -477,6 +477,15 @@ void pump()
|
|||
last_resize_event_used = true;
|
||||
}
|
||||
|
||||
if(SDL_GetModState() & KMOD_ALT) {
|
||||
// Remove text input events, to match the behavior on Windows
|
||||
// See https://github.com/wesnoth/wesnoth/issues/1736
|
||||
events.erase(
|
||||
std::remove_if(events.begin(), events.end(), [](const SDL_Event& e) { return e.type == SDL_TEXTINPUT; }),
|
||||
events.end()
|
||||
);
|
||||
}
|
||||
|
||||
// Move all draw events to the end of the queue
|
||||
auto first_draw_event = std::stable_partition(events.begin(), events.end(),
|
||||
[](const SDL_Event& e) { return e.type != DRAW_EVENT; }
|
||||
|
|
Loading…
Add table
Reference in a new issue