From d7a8fb0f709677b76cbd63e9a48a466a4940b6fb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 29 Oct 2012 00:45:50 +0300 Subject: Highlight window header with * if got new chat message with minimized window. --- src/client.cpp | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'src/client.cpp') 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; + } +} -- cgit v1.2.3-60-g2f50