diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 66d4461c3..9391a6313 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -1,5 +1,6 @@ #include "SDL.h" +#include "SDL_syswm.h" #if defined(__ANDROID__) #define GL_GLEXT_PROTOTYPES #include @@ -647,7 +648,29 @@ int CGraphicsBackend_SDL_OpenGL::WindowActive() int CGraphicsBackend_SDL_OpenGL::WindowOpen() { return SDL_GetAppState()&SDL_APPACTIVE; +} +void CGraphicsBackend_SDL_OpenGL::NotifyWindow() +{ + // get window handle + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if(!SDL_GetWMInfo(&info)) + { + dbg_msg("gfx", "unable to obtain window handle"); + return; + } + + #if defined(CONF_FAMILY_WINDOWS) + FLASHWINFO desc; + desc.cbSize = sizeof(desc); + desc.hwnd = info.window; + desc.dwFlags = FLASHW_TRAY; + desc.uCount = 3; // flash 3 times + desc.dwTimeout = 0; + + FlashWindowEx(&desc); + #endif } diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h index 061e6e751..2e072f081 100644 --- a/src/engine/client/backend_sdl.h +++ b/src/engine/client/backend_sdl.h @@ -308,4 +308,5 @@ public: virtual void Maximize(); virtual int WindowActive(); virtual int WindowOpen(); + virtual void NotifyWindow(); }; diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 0d9d4cf6e..f57fb9685 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -6,6 +6,7 @@ #include #include "SDL.h" +#include "SDL_syswm.h" #if defined(__ANDROID__) #define GL_GLEXT_PROTOTYPES #include @@ -953,6 +954,29 @@ int CGraphics_SDL::WindowActive() int CGraphics_SDL::WindowOpen() { return SDL_GetAppState()&SDL_APPACTIVE; +} + +void CGraphics_SDL::NotifyWindow() +{ + // get window handle + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if(!SDL_GetWMInfo(&info)) + { + dbg_msg("gfx", "unable to obtain window handle"); + return; + } + + #if defined(CONF_FAMILY_WINDOWS) + FLASHWINFO desc; + desc.cbSize = sizeof(desc); + desc.hwnd = info.window; + desc.dwFlags = FLASHW_TRAY; + desc.uCount = 3; // flash 3 times + desc.dwTimeout = 0; + + FlashWindowEx(&desc); + #endif } diff --git a/src/engine/client/graphics.h b/src/engine/client/graphics.h index 7d0fcf7d0..7056958b4 100644 --- a/src/engine/client/graphics.h +++ b/src/engine/client/graphics.h @@ -142,6 +142,8 @@ public: virtual int WindowActive(); virtual int WindowOpen(); + virtual void NotifyWindow(); + virtual void TakeScreenshot(const char *pFilename); virtual void TakeCustomScreenshot(const char *pFilename); virtual void Swap(); diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index bebe18b8e..413ff07d9 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -805,7 +805,11 @@ int CGraphics_Threaded::WindowActive() int CGraphics_Threaded::WindowOpen() { return m_pBackend->WindowOpen(); +} +void CGraphics_Threaded::NotifyWindow() +{ + return m_pBackend->NotifyWindow(); } void CGraphics_Threaded::TakeScreenshot(const char *pFilename) diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index a3931c6e2..be0ee2bad 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -311,6 +311,7 @@ public: virtual void Maximize() = 0; virtual int WindowActive() = 0; virtual int WindowOpen() = 0; + virtual void NotifyWindow() = 0; virtual void RunBuffer(CCommandBuffer *pBuffer) = 0; virtual bool IsIdle() const = 0; @@ -427,6 +428,8 @@ public: virtual int WindowActive(); virtual int WindowOpen(); + virtual void NotifyWindow(); + virtual int Init(); virtual void Shutdown(); diff --git a/src/engine/graphics.h b/src/engine/graphics.h index a36ee1a8e..6f7729a91 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -142,6 +142,8 @@ public: virtual void InsertSignal(class semaphore *pSemaphore) = 0; virtual bool IsIdle() = 0; virtual void WaitForIdle() = 0; + + virtual void NotifyWindow() = 0; }; class IEngineGraphics : public IGraphics @@ -156,7 +158,6 @@ public: virtual int WindowActive() = 0; virtual int WindowOpen() = 0; - }; extern IEngineGraphics *CreateEngineGraphics(); diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index a01529ab2..0ce1145b1 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -452,6 +452,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) { if(Now-m_aLastSoundPlayed[CHAT_HIGHLIGHT] >= time_freq()*3/10) { + Graphics()->NotifyWindow(); m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0); m_aLastSoundPlayed[CHAT_HIGHLIGHT] = Now; }