diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1341,10 +1341,6 @@ struct AIDebugWindow : public QueryStrin { EventState state = ES_NOT_HANDLED; switch (this->HandleEditBoxKey(WID_AID_BREAK_STR_EDIT_BOX, key, keycode, state)) { - case HEBR_EDITING: - this->OnOSKInput(WID_AID_BREAK_STR_EDIT_BOX); - break; - case HEBR_CANCEL: /* Unfocus the text box. */ this->UnfocusFocusedWidget(); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -697,7 +697,7 @@ struct GenerateLandscapeWindow : public virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - if (this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state) == HEBR_EDITING) this->OnOSKInput(WID_GL_RANDOM_EDITBOX); + this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state); return state; } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -757,6 +757,9 @@ HandleEditBoxResult QueryString::HandleE } } + Window *osk = FindWindowById(WC_OSK, 0); + if (osk != NULL && osk->parent == w) osk->InvalidateData(); + return HEBR_EDITING; } @@ -810,7 +813,15 @@ void QueryString::DrawEditBox(const Wind HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state) { - return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state); + HandleEditBoxResult result = this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state); + switch (result) { + case HEBR_EDITING: + this->OnOSKInput(wid); + break; + + default: break; + } + return result; } void QueryStringBaseWindow::OnOpenOSKWindow(int wid) @@ -898,16 +909,10 @@ struct QueryStringWindow : public QueryS { EventState state = ES_NOT_HANDLED; switch (this->HandleEditBoxKey(WID_QS_TEXT, key, keycode, state)) { - default: NOT_REACHED(); - case HEBR_EDITING: { - Window *osk = FindWindowById(WC_OSK, 0); - if (osk != NULL && osk->parent == this) osk->InvalidateData(); - break; - } + default: break; case HEBR_CONFIRM: this->OnOk(); /* FALL THROUGH */ case HEBR_CANCEL: delete this; break; // close window, abandon changes - case HEBR_NOT_FOCUSED: break; } return state; } diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -511,17 +511,11 @@ struct NetworkChatWindow : public QueryS } else { _chat_tab_completion_active = false; switch (this->HandleEditBoxKey(WID_NC_TEXTBOX, key, keycode, state)) { - default: NOT_REACHED(); - case HEBR_EDITING: { - Window *osk = FindWindowById(WC_OSK, 0); - if (osk != NULL && osk->parent == this) osk->InvalidateData(); - break; - } + default: break; case HEBR_CONFIRM: SendChat(this->text.buf, this->dtype, this->dest); /* FALL THROUGH */ case HEBR_CANCEL: delete this; break; - case HEBR_NOT_FOCUSED: break; } } return state; diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -766,10 +766,7 @@ public: default: { /* Handle editbox input */ EventState state = ES_NOT_HANDLED; - if (this->HandleEditBoxKey(WID_NCL_FILTER, key, keycode, state) == HEBR_EDITING) { - this->OnOSKInput(WID_NCL_FILTER); - } - + this->HandleEditBoxKey(WID_NCL_FILTER, key, keycode, state); return state; } } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -847,11 +847,7 @@ public: } break; - case HEBR_CONFIRM: - break; - default: - this->OnOSKInput(WID_NG_CLIENT); break; } @@ -1184,16 +1180,7 @@ struct NetworkStartServerWindow : public virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - switch (this->HandleEditBoxKey(WID_NSS_GAMENAME, key, keycode, state)) { - case HEBR_CONFIRM: - case HEBR_NOT_FOCUSED: - break; - - default: - this->OnOSKInput(WID_NSS_GAMENAME); - break; - } - + this->HandleEditBoxKey(WID_NSS_GAMENAME, key, keycode, state); return state; } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1265,9 +1265,7 @@ struct NewGRFWindow : public QueryString default: { /* Handle editbox input */ EventState state = ES_NOT_HANDLED; - if (this->HandleEditBoxKey(WID_NS_FILTER, key, keycode, state) == HEBR_EDITING) { - this->OnOSKInput(WID_NS_FILTER); - } + this->HandleEditBoxKey(WID_NS_FILTER, key, keycode, state); return state; } } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2410,9 +2410,7 @@ struct GameSettingsWindow : QueryStringB { /* Handle editbox input */ EventState state = ES_NOT_HANDLED; - if (this->HandleEditBoxKey(WID_GS_FILTER, key, keycode, state) == HEBR_EDITING) { - this->OnOSKInput(WID_GS_FILTER); - } + this->HandleEditBoxKey(WID_GS_FILTER, key, keycode, state); return state; } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -297,10 +297,6 @@ struct SignListWindow : QueryStringBaseW { EventState state = ES_NOT_HANDLED; switch (this->HandleEditBoxKey(WID_SIL_FILTER_TEXT, key, keycode, state)) { - case HEBR_EDITING: - this->OnOSKInput(WID_SIL_FILTER_TEXT); - break; - case HEBR_CONFIRM: // Enter pressed -> goto first sign in list if (this->signs.Length() >= 1) { const Sign *si = this->signs[0]; @@ -322,7 +318,7 @@ struct SignListWindow : QueryStringBaseW break; default: - NOT_REACHED(); + break; } return state;