mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2026-08-01 14:08:52 +00:00
when you press e.g. 'b' to enter a text dialog, 'b' is not sent to this dialog
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user