Recompute textboxes on active input device change

This fixes a bug where some text boxes wouldn't update the displayed
button if the active input device changed from a keyboard to controller,
or vice versa. Namely, the "Press ACTION to continue" text boxes.
This commit is contained in:
Misa 2024-01-21 15:49:16 -08:00 committed by Misa Elizabeth Kai
parent 505956ae83
commit 861f724d90
1 changed files with 11 additions and 1 deletions

View File

@ -153,6 +153,9 @@ void KeyPoll::Poll(void)
bool fullscreenkeybind = false;
SDL_GameController *controller = NULL;
SDL_Event evt;
bool should_recompute_textboxes = false;
bool active_input_device_changed = false;
bool keyboard_was_active = BUTTONGLYPHS_keyboard_is_active();
while (SDL_PollEvent(&evt))
{
switch (evt.type)
@ -206,7 +209,7 @@ void KeyPoll::Poll(void)
loc::loadtext(false);
graphics.grphx.init_translations();
recomputetextboxes();
should_recompute_textboxes = true;
}
}
else
@ -514,6 +517,13 @@ void KeyPoll::Poll(void)
mousex = raw_mousex;
mousey = raw_mousey;
}
active_input_device_changed = keyboard_was_active != BUTTONGLYPHS_keyboard_is_active();
should_recompute_textboxes |= active_input_device_changed;
if (should_recompute_textboxes)
{
recomputetextboxes();
}
}
bool KeyPoll::isDown(SDL_Keycode key)