when you press e.g. 'b' to enter a text dialog, 'b' is not sent to this dialog

This commit is contained in:
Zeno Rogue
2026-01-29 14:25:02 +01:00
parent 9268143240
commit 692399ac45
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -1255,6 +1255,7 @@ EX void mainloopiter() {
if(((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2())
currently_scrolling = true;
ignore_textinput = false;
ui_mousex = mousex, ui_mousey = mousey;
#if SDLVER >= 2
if(timetowait > 0) {
@@ -1275,6 +1276,8 @@ EX void mainloopiter() {
EX bool need_refresh;
EX int ui_mousex, ui_mousey;
EX bool ignore_textinput;
EX void refresh_if_needed() {
if(!need_refresh) return;
just_refreshing = 1;
@@ -1427,7 +1430,8 @@ EX void handle_event(SDL_Event& ev) {
#if SDLVER >= 2
if(ev.type == SDL_EVENT_TEXT_INPUT) {
refresh_if_needed();
texthandler(ev.text);
if(ignore_textinput) ignore_textinput = false;
else texthandler(ev.text);
}
#endif
+2
View File
@@ -995,10 +995,12 @@ EX namespace dialog {
EX void handle_actions(int &sym, int &uni) {
if(key_actions.count(uni)) {
key_actions[uni]();
if(uni >= ' ' && uni <= 127) ignore_textinput = true;
sym = uni = 0;
return;
}
if(key_actions.count(sym)) {
if(sym >= ' ' && sym <= 127) ignore_textinput = true;
key_actions[sym]();
sym = uni = 0;
return;