From 1071d51508695978adcf9a184e0a26a65fff2705 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 13 Nov 2012 21:46:37 +0000 Subject: (svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever. --- src/network/network_gui.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/network') diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index d01f20e28..99256bda9 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -851,18 +851,25 @@ public: break; default: - /* The name is only allowed when it starts with a letter! */ - if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') { - strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name)); - } else { - strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name)); - } + this->OnOSKInput(WID_NG_CLIENT); break; } return state; } + virtual void OnOSKInput(int wid) + { + if (wid == WID_NG_CLIENT) { + /* The name is only allowed when it starts with a letter! */ + if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') { + strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name)); + } else { + strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name)); + } + } + } + virtual void OnQueryTextFinished(char *str) { if (!StrEmpty(str)) NetworkAddServer(str); @@ -1183,13 +1190,20 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { break; default: - strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); + this->OnOSKInput(WID_NSS_GAMENAME); break; } return state; } + virtual void OnOSKInput(int wid) + { + if (wid == WID_NSS_GAMENAME) { + strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); + } + } + virtual void OnTimeout() { static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END}; -- cgit v1.2.3-54-g00ecf