diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 4173f9145..6d4745af3 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -1183,17 +1183,25 @@ namespace GUIEngine // ---- some menus may need updating if (gamestate != GAME) { + bool dialog_opened = false; + if (ScreenKeyboard::isActive()) { ScreenKeyboard::getCurrent()->onUpdate(dt); + dialog_opened = true; } else if (ModalDialog::isADialogActive()) { ModalDialog::getCurrent()->onUpdate(dt); + dialog_opened = true; } - else + + Screen* screen = getCurrentScreen(); + + if (screen != NULL && + (!dialog_opened || screen->getUpdateInBackground())) { - getCurrentScreen()->onUpdate(elapsed_time); + screen->onUpdate(elapsed_time); } } else diff --git a/src/guiengine/screen.cpp b/src/guiengine/screen.cpp index 995a9711c..e9de90c4f 100644 --- a/src/guiengine/screen.cpp +++ b/src/guiengine/screen.cpp @@ -58,6 +58,7 @@ Screen::Screen(const char* file, bool pause_race) m_render_3d = false; m_loaded = false; m_pause_race = pause_race; + m_update_in_background = false; } // Screen // ----------------------------------------------------------------------------- @@ -71,6 +72,7 @@ Screen::Screen(bool pause_race) m_loaded = false; m_render_3d = false; m_pause_race = pause_race; + m_update_in_background = false; } // Screen // ----------------------------------------------------------------------------- diff --git a/src/guiengine/screen.hpp b/src/guiengine/screen.hpp index b4334b0ef..0e82f36f9 100644 --- a/src/guiengine/screen.hpp +++ b/src/guiengine/screen.hpp @@ -113,6 +113,11 @@ namespace GUIEngine /** to catch errors as early as possible, for debugging purposes only */ unsigned int m_magic_number; + /** When set to true it updates the screen even if modal dialog is + * opened + */ + bool m_update_in_background; + protected: bool m_throttle_FPS; @@ -155,6 +160,12 @@ namespace GUIEngine void manualAddWidget(Widget* w); void manualRemoveWidget(Widget* w); + + /** When set to true it updates the screen even if modal dialog is + * opened + */ + void setUpdateInBackground(bool value) {m_update_in_background = value;} + bool getUpdateInBackground() {return m_update_in_background;} /** \return the name of this menu (which is the name of the file) */ const std::string& getName() const { return m_filename; } diff --git a/src/states_screens/online/networking_lobby.cpp b/src/states_screens/online/networking_lobby.cpp index f758b5f70..f82e9c93d 100644 --- a/src/states_screens/online/networking_lobby.cpp +++ b/src/states_screens/online/networking_lobby.cpp @@ -75,6 +75,9 @@ NetworkingLobby::NetworkingLobby() : Screen("online/networking_lobby.stkgui") m_chat_box = NULL; m_send_button = NULL; m_icon_bank = NULL; + + // Allows to update chat and counter even if dialog window is opened + setUpdateInBackground(true); } // NetworkingLobby // ----------------------------------------------------------------------------