diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp index 7df9febd6..3b4bc3203 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -276,7 +276,8 @@ Client::Client(const Options &options) : mIsMinimized(false), mInputFocused(true), mMouseFocused(true), - mGuiAlpha(1.0f) + mGuiAlpha(1.0f), + mNewMessageFlag(false) { mInstance = this; } @@ -395,18 +396,20 @@ void Client::gameInit() if (mOptions.test.empty()) { - SDL_WM_SetCaption(strprintf("%s %s", + mCaption = strprintf("%s %s", branding.getStringValue("appName").c_str(), - SMALL_VERSION).c_str(), nullptr); + SMALL_VERSION); } else { - SDL_WM_SetCaption(strprintf( + mCaption = strprintf( "Please wait - VIDEO MODE TEST - %s %s - Please wait", branding.getStringValue("appName").c_str(), - SMALL_VERSION).c_str(), nullptr); + SMALL_VERSION); } + SDL_WM_SetCaption(mCaption.c_str(), nullptr); + const ResourceManager *const resman = ResourceManager::getInstance(); if (!resman->setWriteDir(mLocalDataDir)) @@ -2566,3 +2569,31 @@ void Client::applyKeyRepeat() SDL_EnableKeyRepeat(config.getIntValue("repeateDelay"), config.getIntValue("repeateInterval")); } + +void Client::setIsMinimized(const bool n) +{ + Client *client = instance(); + if (!client) + return; + + client->mIsMinimized = n; + if (!n && client->mNewMessageFlag) + { + client->mNewMessageFlag = false; + SDL_WM_SetCaption(client->mCaption.c_str(), nullptr); + } +} + +void Client::newChatMessage() +{ + Client *client = instance(); + if (!client) + return; + + if (!client->mNewMessageFlag && client->mIsMinimized) + { + // show * on window caption + SDL_WM_SetCaption(("*" + client->mCaption).c_str(), nullptr); + client->mNewMessageFlag = true; + } +} |