From 8bd59593912495db8b41f885c1c9c8c5687e4156 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 31 May 2018 12:24:51 +0300 Subject: fixes #1397 (StdMsg: dynamic loading breaks meta menu) --- src/core/stdmsg/src/msgs.cpp | 2 -- src/core/stdmsg/src/statusicon.cpp | 10 +--------- src/core/stdmsg/src/statusicon.h | 1 - src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/srmm_statusicon.cpp | 14 ++++++++++++-- 6 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 869d679855..cdadeba179 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -479,8 +479,6 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) int PreshutdownSendRecv(WPARAM, LPARAM) { Srmm_Broadcast(DM_CLOSETAB, 0, 0); - - DeinitStatusIcons(); return 0; } diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index 76509152cc..0246d2a762 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -67,20 +67,12 @@ void CheckStatusIconClick(MCONTACT hContact, HWND hwndFrom, POINT pt, const RECT sicd.dwId = sid->dwId; sicd.szModule = sid->szModule; sicd.flags = click_flags; - NotifyEventHooks(hHookIconPressedEvt, hContact, (LPARAM)&sicd); + Srmm_ClickStatusIcon(hContact, &sicd); } int InitStatusIcons() { HookEvent(ME_MSG_ICONSCHANGED, OnSrmmIconChanged); - - hHookIconPressedEvt = CreateHookableEvent(ME_MSG_ICONPRESSED); - return 0; -} - -int DeinitStatusIcons() -{ - DestroyHookableEvent(hHookIconPressedEvt); return 0; } diff --git a/src/core/stdmsg/src/statusicon.h b/src/core/stdmsg/src/statusicon.h index 8a267917dc..209e411671 100644 --- a/src/core/stdmsg/src/statusicon.h +++ b/src/core/stdmsg/src/statusicon.h @@ -5,7 +5,6 @@ extern HANDLE hHookIconPressedEvt; extern int status_icon_list_size; int InitStatusIcons(); -int DeinitStatusIcons(); int GetStatusIconsCount(MCONTACT hContact); void DrawStatusIcons(MCONTACT hContact, HDC hdc, const RECT &rc, int gap); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 6920cdcb3d..33f5a59f10 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -617,3 +617,4 @@ UnregisterPlugin @633 ??_7CMPluginBase@@6B@ @646 NONAME ?Load@CMPluginBase@@UAEHXZ @647 NONAME ?Unload@CMPluginBase@@UAEHXZ @648 NONAME +Srmm_ClickStatusIcon @649 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index d72137f7cc..67d1f4ee8b 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -617,3 +617,4 @@ UnregisterPlugin @633 ??_7CMPluginBase@@6B@ @646 NONAME ?Load@CMPluginBase@@UEAAHXZ @647 NONAME ?Unload@CMPluginBase@@UEAAHXZ @648 NONAME +Srmm_ClickStatusIcon @649 diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index 87a83542d9..34499a7f27 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" HCURSOR g_hCurHyperlinkHand; +HANDLE hHookSrmmEvent; + +static HANDLE hHookIconsChanged, hHookIconPressedEvt; void LoadSrmmToolbarModule(); void UnloadSrmmToolbarModule(); @@ -79,8 +82,6 @@ static int CompareIcons(const StatusIconMain *p1, const StatusIconMain *p2) static OBJLIST arIcons(3, CompareIcons); -HANDLE hHookIconsChanged, hHookSrmmEvent; - ///////////////////////////////////////////////////////////////////////////////////////// MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) @@ -195,6 +196,13 @@ MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int index) ///////////////////////////////////////////////////////////////////////////////////////// +MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusIconData *sid) +{ + NotifyEventHooks(hHookIconPressedEvt, hContact, (LPARAM)sid); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void KillModuleSrmmIcons(int _hLang) { auto T = arIcons.rev_iter(); @@ -211,6 +219,7 @@ int LoadSrmmModule() hHookSrmmEvent = CreateHookableEvent(ME_MSG_WINDOWEVENT); hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED); + hHookIconPressedEvt = CreateHookableEvent(ME_MSG_ICONPRESSED); return 0; } @@ -220,6 +229,7 @@ void UnloadSrmmModule() DestroyHookableEvent(hHookIconsChanged); DestroyHookableEvent(hHookSrmmEvent); + DestroyHookableEvent(hHookIconPressedEvt); DestroyCursor(g_hCurHyperlinkHand); -- cgit v1.2.3