summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/ai_gui.cpp4
-rw-r--r--src/genworld_gui.cpp2
-rw-r--r--src/misc_gui.cpp21
-rw-r--r--src/network/network_chat_gui.cpp8
-rw-r--r--src/network/network_content_gui.cpp5
-rw-r--r--src/network/network_gui.cpp15
-rw-r--r--src/newgrf_gui.cpp4
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/signs_gui.cpp6
9 files changed, 20 insertions, 49 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 98feba077..26e794c89 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1341,10 +1341,6 @@ struct AIDebugWindow : public QueryStringBaseWindow {
{
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
index 36b25dbff..26911f309 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -697,7 +697,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
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
index d941f0633..18ec4d8ee 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -757,6 +757,9 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key
}
}
+ 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 Window *w, int wid) const
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 QueryStringBaseWindow
{
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
index 9e7115d9e..a6a63703d 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -511,17 +511,11 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
} 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
index ed4010d40..995f40ddf 100644
--- 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
index 99256bda9..0174497bd 100644
--- 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 QueryStringBaseWindow {
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
index 331431356..85f6e3618 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -1265,9 +1265,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
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
index c74098ae5..4091bb25c 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -2410,9 +2410,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
{
/* 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
index 3af782266..1089a2f87 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -297,10 +297,6 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
{
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 : QueryStringBaseWindow, SignList {
break;
default:
- NOT_REACHED();
+ break;
}
return state;