summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-01 23:09:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-01 23:09:14 +0300
commitdf32d54d3b04bd5b4cfdc550b0d8b01fc12a7c15 (patch)
tree39b438338b7422706d02bf9bb03fa75ca9184e5d /src/core/stdmsg
parent0f70686e38c1b4d9165059c8b98986d8fa12d85e (diff)
StdMsg: inactive tabs blink in background if there's an unread message
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp8
-rw-r--r--src/core/stdmsg/src/msgs.cpp11
-rw-r--r--src/core/stdmsg/src/msgs.h6
-rw-r--r--src/core/stdmsg/src/tabs.cpp15
5 files changed, 22 insertions, 20 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 7471f5e0c5..a7da3d841a 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -197,7 +197,7 @@ void CChatRoomDlg::onSplitterY(CSplitter *pSplitter)
int CChatRoomDlg::GetImageId() const
{
- if (m_si->wState & GC_EVENT_HIGHLIGHT)
+ if ((m_si->wState & GC_EVENT_HIGHLIGHT) && (m_nFlash & 1))
return 0;
MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index aac3471b28..bec0e25d12 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -453,6 +453,9 @@ void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter)
int CSrmmWindow::GetImageId() const
{
+ if (m_nFlash & 1)
+ return 0;
+
return (WORD)g_clistApi.pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
}
@@ -1190,11 +1193,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER:
if (wParam == TIMERID_FLASHWND) {
- if (m_nFlash > 2 * g_dat.nFlashMax) {
+ if (m_nFlash > 2 * g_dat.nFlashMax)
StopFlash();
- m_nFlash = 0;
- }
- m_nFlash++;
}
else if (wParam == TIMERID_TYPE) {
ShowTime(false);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 46e2426657..0a8658f835 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -51,8 +51,11 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case WM_TIMER:
- if (wParam == TIMERID_FLASHWND)
+ if (wParam == TIMERID_FLASHWND) {
+ m_pOwner->FixTabIcons(this);
FlashWindow(m_pOwner->GetHwnd(), TRUE);
+ m_nFlash++;
+ }
break;
case WM_MOUSEACTIVATE:
@@ -71,8 +74,12 @@ void CMsgDialog::StartFlash()
void CMsgDialog::StopFlash()
{
- if (::KillTimer(m_hwnd, TIMERID_FLASHWND))
+ if (::KillTimer(m_hwnd, TIMERID_FLASHWND)) {
::FlashWindow(m_pOwner->GetHwnd(), FALSE);
+
+ m_nFlash = 0;
+ m_pOwner->FixTabIcons(this);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index 7a9f280a6a..cf9270de84 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -50,11 +50,10 @@ class CMsgDialog : public CSrmmBaseDialog
protected:
CCtrlButton m_btnOk;
CTabbedWindow *m_pOwner;
+ DWORD m_nFlash = 0;
CMsgDialog(CTabbedWindow *pOwner, int idDialog, SESSION_INFO *si = nullptr);
- virtual int GetImageId() const PURE;
-
virtual const char* GetProto() const PURE;
virtual int GetStatus() const PURE;
@@ -63,6 +62,8 @@ protected:
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
public:
+ virtual int GetImageId() const PURE;
+
void CloseTab() override;
void StartFlash();
@@ -99,7 +100,6 @@ class CSrmmWindow : public CMsgDialog
RECT m_minEditInit;
int m_windowWasCascaded;
- DWORD m_nFlash;
int m_nTypeSecs, m_nTypeMode;
int m_limitAvatarH;
DWORD m_nLastTyping;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 72c3a87a5a..5c85b8c7e4 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -78,16 +78,11 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if (idx != -1) {
CMsgDialog *pDlg = (CMsgDialog*)pOwner->m_tab.GetNthPage(idx);
if (pDlg) {
- SESSION_INFO *si = pDlg->getChat();
- if (si != nullptr) {
- bool bOnline = db_get_w(si->hContact, si->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE;
- MODULEINFO *mi = g_chatApi.MM_FindModule(si->pszModule);
- bDragging = true;
- iBeginIndex = idx;
- ImageList_BeginDrag(Clist_GetImageList(), bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
+ bDragging = true;
+ iBeginIndex = idx;
+ ImageList_BeginDrag(Clist_GetImageList(), pDlg->GetImageId(), 8, 8);
+ ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ SetCapture(hwnd);
}
return TRUE;
}