From dc16fa8c5fa2e477b6ce896b8eb237462735baae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 13:17:19 +0000 Subject: fix for window flashing in StdChat & Scriver git-svn-id: http://svn.miranda-ng.org/main/trunk@7809 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_chat_int.h | 1 + plugins/Scriver/src/chat/main.cpp | 19 ++++++++++++++++--- plugins/TabSRMM/src/chat/tools.cpp | 8 ++------ src/core/stdchat/src/main.cpp | 16 ++++++++++++++-- src/modules/chat/tools.cpp | 4 ++-- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/include/m_chat_int.h b/include/m_chat_int.h index c9f5949145..53ca526607 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -433,6 +433,7 @@ struct CHAT_MANAGER void (*OnLoadSettings)(void); void (*OnFlashWindow)(SESSION_INFO *si, int); + void (*OnFlashHighlight)(SESSION_INFO *si, int); }; extern CHAT_MANAGER ci, *pci; diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 37dc0bb167..bb86a5013c 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -106,12 +106,24 @@ static void OnSetStatus(SESSION_INFO *si, int wStatus) PostMessage(si->hWnd, GC_FIXTABICONS, 0, 0); } +static void OnFlashHighlight(SESSION_INFO *si, int bInactive) +{ + if (!bInactive || !si->hWnd) + return; + + if (g_Settings.bFlashWindowHighlight) + SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0); + SendMessage(si->hWnd, GC_SETMESSAGEHIGHLIGHT, 0, 0); +} + static void OnFlashWindow(SESSION_INFO *si, int bInactive) { - if (bInactive && si->hWnd && g_Settings.bFlashWindowHighlight) + if (!bInactive || !si->hWnd) + return; + + if (g_Settings.bFlashWindow) SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0); - if (bInactive && si->hWnd) - SendMessage(si->hWnd, GC_SETMESSAGEHIGHLIGHT, 0, 0); + SendMessage(si->hWnd, GC_SETTABHIGHLIGHT, 0, 0); } static void OnCreateModule(MODULEINFO *mi) @@ -195,6 +207,7 @@ int Chat_Load() pci->OnEventBroadcast = OnEventBroadcast; pci->OnSetStatusBar = OnSetStatusBar; pci->OnFlashWindow = OnFlashWindow; + pci->OnFlashHighlight = OnFlashHighlight; pci->ShowRoom = ShowRoom; pci->DoPopup = DoPopup; diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index a70018736a..f57a8b9f8c 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -338,16 +338,14 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight DoTrayIcon(si, gce); } - /* TODO fix for 3.0 final !!! */ -#if !defined(__DELAYED_FOR_3_1) - if (g_Settings.bCreateWindowOnHighlight && 0 == dat) + if (g_Settings.bCreateWindowOnHighlight && dat == NULL) wParamForHighLight = 1; if (dat && g_Settings.bAnnoyingHighlight && params->bInactive && dat->pContainer->hwnd != GetForegroundWindow()) { wParamForHighLight = 2; params->hWnd = dat->hwnd; } -#endif + if (dat || !nen_options.iMUCDisable) DoPopup(si, gce); if (params->bInactive && si && si->hWnd) @@ -600,14 +598,12 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO AppendMenu(*hMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText); } -#if !defined(__DELAYED_FOR_3_1) if (iIndex == 0) { AppendMenu(*hMenu, MF_SEPARATOR, 0, 0); int pos = GetMenuItemCount(*hMenu); InsertMenu(*hMenu, pos, MF_BYPOSITION, (UINT_PTR)20020, TranslateT("Highlight User...")); InsertMenu(*hMenu, pos, MF_BYPOSITION, (UINT_PTR)20021, TranslateT("Edit Highlight List...")); } -#endif return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); } diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 61be5168ad..fad58d97e2 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -229,17 +229,28 @@ static void OnSetTopic(SESSION_INFO *si) g_TabSession.ptszTopic = si->ptszTopic; } -static void OnFlashWindow(SESSION_INFO *si, int bInactive) +static void OnFlashHighlight(SESSION_INFO *si, int bInactive) { if (!bInactive) return; - + if (!g_Settings.bTabsEnable && si->hWnd && g_Settings.bFlashWindowHighlight) SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL); if (g_Settings.bTabsEnable && g_TabSession.hWnd) SendMessage(g_TabSession.hWnd, GC_SETMESSAGEHIGHLIGHT, 0, (LPARAM)si); } +static void OnFlashWindow(SESSION_INFO *si, int bInactive) +{ + if (!bInactive) + return; + + if (!g_Settings.bTabsEnable && si->hWnd && g_Settings.bFlashWindow) + SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL); + if (g_Settings.bTabsEnable && g_TabSession.hWnd) + SendMessage(g_TabSession.hWnd, GC_SETTABHIGHLIGHT, 0, (LPARAM)si); +} + static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) { if (gce->pDest->iType & g_Settings.dwTrayIconFlags) @@ -349,6 +360,7 @@ extern "C" __declspec(dllexport) int Load(void) pci->OnLoadSettings = OnLoadSettings; pci->OnSetStatusBar = OnSetStatusBar; pci->OnFlashWindow = OnFlashWindow; + pci->OnFlashHighlight = OnFlashHighlight; pci->ShowRoom = ShowRoom; pci->DoPopup = DoPopup; diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index a553c4c916..5574f49e86 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -293,8 +293,8 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight ci.DoTrayIcon(si, gce); if (bInactive || !g_Settings->bPopupInactiveOnly) ci.DoPopup(si, gce); - if (ci.OnFlashWindow) - ci.OnFlashWindow(si, bInactive); + if (ci.OnFlashHighlight) + ci.OnFlashHighlight(si, bInactive); return TRUE; } -- cgit v1.2.3