summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-29 00:45:50 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-29 00:47:23 +0300
commitd7a8fb0f709677b76cbd63e9a48a466a4940b6fb (patch)
tree7a4cd71809b8992f9e2d11d8aa212a7acc181480 /src/client.cpp
parent47cebf2c33561324ab800ec6ab8e5267b6550b1f (diff)
downloadmanaplus-d7a8fb0f709677b76cbd63e9a48a466a4940b6fb.tar.gz
manaplus-d7a8fb0f709677b76cbd63e9a48a466a4940b6fb.tar.bz2
manaplus-d7a8fb0f709677b76cbd63e9a48a466a4940b6fb.tar.xz
manaplus-d7a8fb0f709677b76cbd63e9a48a466a4940b6fb.zip
Highlight window header with * if got new chat message with minimized window.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp41
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;
+ }
+}