From 6dc8111b7f9534aaf7aa22f979857ee0593cae90 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Dec 2016 14:27:45 +0300 Subject: minus Scriver's own window list --- plugins/Scriver/src/globals.cpp | 2 -- plugins/Scriver/src/globals.h | 1 - plugins/Scriver/src/msgdialog.cpp | 6 +++--- plugins/Scriver/src/msgoptions.cpp | 12 ++++++------ plugins/Scriver/src/msgs.cpp | 30 +++++++++++++++--------------- plugins/Scriver/src/statusicon.cpp | 2 +- 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index ea52bcf287..8c2f469b17 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -287,7 +287,6 @@ void InitGlobals() HDC hdc = GetDC(NULL); memset(&g_dat, 0, sizeof(struct GlobalMessageData)); - g_dat.hMessageWindowList = WindowList_Create(); g_dat.hParentWindowList = WindowList_Create(); HookEvent(ME_PROTO_ACK, ackevent); @@ -324,7 +323,6 @@ void FreeGlobals() ImageList_Destroy(g_dat.hSearchEngineIconList); mir_free(g_dat.tabIconListUsage); - WindowList_Destroy(g_dat.hMessageWindowList); WindowList_Destroy(g_dat.hParentWindowList); memset(&g_dat, 0, sizeof(g_dat)); diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 30c1ee6a88..bf78d0b259 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -82,7 +82,6 @@ struct GlobalMessageData { unsigned int flags; unsigned int flags2; - MWindowList hMessageWindowList; DWORD openFlags; MWindowList hParentWindowList; ParentWindowData *lastParent; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index d2aa4d42f0..0d5ba8e5ad 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -116,7 +116,7 @@ void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) mwe.szModule = SRMMMOD; mwe.uType = type; mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - if (WindowList_Find(g_dat.hMessageWindowList, hContact)) { + if (WindowList_Find(pci->hWindowList, hContact)) { mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE); mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG); } @@ -675,7 +675,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat = (SrmmWindowData*)mir_calloc(sizeof(SrmmWindowData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact = newData->hContact; - WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact); + WindowList_Add(pci->hWindowList, hwndDlg, dat->hContact); NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING); @@ -1791,7 +1791,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } tcmdlist_free(dat->cmdList); - WindowList_Remove(g_dat.hMessageWindowList, hwndDlg); + WindowList_Remove(pci->hWindowList, hwndDlg); HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0); if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0)) diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 0dfdb2d36a..eb19b8d919 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -80,7 +80,7 @@ int FontServiceFontsChanged(WPARAM, LPARAM) { LoadMsgLogIcons(); LoadInfobarFonts(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); return 0; } @@ -131,14 +131,14 @@ int IconsChanged(WPARAM, LPARAM) FreeMsgLogIcons(); LoadMsgLogIcons(); ChangeStatusIcons(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, 0, 0); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_CHANGEICONS, 0, 1); + WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_CHANGEICONS, 0, 1); return 0; } int SmileySettingsChanged(WPARAM wParam, LPARAM) { - WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, wParam, 0); + WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, wParam, 0); return 0; } @@ -238,7 +238,7 @@ static void ApplyChanges(int i) if (changed == 0) { ReloadGlobals(); WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); } } @@ -918,7 +918,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPINGSWITCH)); ReloadGlobals(); - WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); + WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); } break; } diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 3f286a8fea..6d050c0a11 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -78,7 +78,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) CLISTEVENT *pcle = (CLISTEVENT*)lParam; MCONTACT hContact = db_mc_tryMeta(pcle->hContact); - HWND hwndExisting = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwndExisting = WindowList_Find(pci->hWindowList, hContact); if (hwndExisting == NULL) { NewMessageWindowLParam newData = { 0 }; newData.hContact = hContact; @@ -96,9 +96,9 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) return 0; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd == NULL) - hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact = db_event_getContact(hDbEvent)); + hwnd = WindowList_Find(pci->hWindowList, hContact = db_event_getContact(hDbEvent)); if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, hContact, lParam); @@ -149,7 +149,7 @@ static INT_PTR SendMessageCommandWorker(MCONTACT hContact, LPCSTR pszMsg, bool i if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 1; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd != NULL) { if (pszMsg) { HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); @@ -201,7 +201,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { @@ -217,13 +217,13 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = GetContactProto(hContact); // szProto maybe NULL if (!strcmp(cws->szModule, "CList") || !mir_strcmp(cws->szModule, szProto)) - WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, hContact, lParam); + WindowList_Broadcast(pci->hWindowList, DM_CLISTSETTINGSCHANGED, hContact, lParam); return 0; } static int ContactDeleted(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(pci->hWindowList, wParam); if (hwnd) SendMessage(hwnd, WM_CLOSE, 0, 0); return 0; @@ -255,7 +255,7 @@ static void RestoreUnreadMessageAlerts(void) if ((dbei.flags & (DBEF_SENT | DBEF_READ)) || !DbEventIsMessageOrCustom(&dbei)) continue; - int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL; + int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != NULL; if (windowAlreadyExists) continue; @@ -310,7 +310,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) if (mwd == NULL || mwd->cbSize != sizeof(MessageWindowData)) return 1; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact); if (hwnd == NULL) hwnd = SM_FindWindowByContact(mwid->hContact); mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; @@ -327,7 +327,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) return 1; ParentWindowData *pdat; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd == NULL) { hwnd = SM_FindWindowByContact(hContact); if (hwnd == NULL) @@ -374,9 +374,9 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) static int AvatarChanged(WPARAM wParam, LPARAM lParam) { if (wParam == 0) // protocol picture has changed... - WindowList_Broadcast(g_dat.hMessageWindowList, DM_AVATARCHANGED, wParam, lParam); + WindowList_Broadcast(pci->hWindowList, DM_AVATARCHANGED, wParam, lParam); else { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(pci->hWindowList, wParam); SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam); } return 0; @@ -413,7 +413,7 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) if (mir_strcmp(SRMMMOD, sicd->szModule)) return 0; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(pci->hWindowList, wParam); if (hwnd == NULL) hwnd = SM_FindWindowByContact(wParam); @@ -535,7 +535,7 @@ static int ModuleLoad(WPARAM, LPARAM) static int MetaContactChanged(WPARAM hMeta, LPARAM) { if (hMeta) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hMeta); + HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); if (hwnd != NULL) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } @@ -574,7 +574,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) int OnSystemPreshutdown(WPARAM, LPARAM) { - WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0); + WindowList_Broadcast(pci->hWindowList, WM_CLOSE, 0, 0); WindowList_Broadcast(g_dat.hParentWindowList, WM_CLOSE, 0, 0); DeinitStatusIcons(); return 0; diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index e280fc7165..73b17b6c52 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -64,7 +64,7 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) if (hContact == NULL) WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0); else { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); + HWND hwnd = WindowList_Find(pci->hWindowList, hContact); if (hwnd == NULL) hwnd = SM_FindWindowByContact(hContact); if (hwnd != NULL) -- cgit v1.2.3