diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-04 14:15:55 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-04 14:15:55 +0300 |
commit | 8937c49faab219b51b9863847406a21945d3a9cb (patch) | |
tree | 95390d236af9d832f3c7c50a2fc2de357a353996 | |
parent | a5d8287df3cb04ddea3888cce55ce08f4d5fe73b (diff) |
Windows lists:
- fix for a 64-bit issue that could cause a crash;
- code cleaning
-rw-r--r-- | include/m_utils.h | 6 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 321536 -> 321582 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 322568 -> 322614 bytes | |||
-rw-r--r-- | plugins/Clist_modern/src/modern_tbbutton.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/CurrencyConverter.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_ini.cpp | 2 | ||||
-rw-r--r-- | plugins/YAMN/src/browser/mailbrowser.cpp | 10 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3opt.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/clc.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/src/windowlist.cpp | 14 |
11 files changed, 21 insertions, 23 deletions
diff --git a/include/m_utils.h b/include/m_utils.h index bd07c2ac9e..f7bf4cb80d 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -138,7 +138,7 @@ EXTERN_C MIR_CORE_DLL(void) WindowList_Destroy(MWindowList &hList); // adds a window to the specified window list
// returns 0 on success, nonzero on failure
-EXTERN_C MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact);
+EXTERN_C MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, UINT_PTR param = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// removes a window from the specified window list
@@ -147,10 +147,10 @@ EXTERN_C MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT EXTERN_C MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd);
/////////////////////////////////////////////////////////////////////////////////////////
-// finds a window given the hContact
+// finds a window by associated parameter's value
// returns the window handle on success, or NULL on failure
-EXTERN_C MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact);
+EXTERN_C MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, UINT_PTR param);
/////////////////////////////////////////////////////////////////////////////////////////
// sends a message to all windows in a list using SendMessage
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex ed22859f77..239ece337c 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 660257d5e4..5877d4c2eb 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index 4f53fb353e..9e6df49d3b 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -465,7 +465,7 @@ void MakeButtonSkinned(HWND hWnd) p->nFontID = -1;
p->hThemeButton = xpt_AddThemeHandle(p->hwnd, L"BUTTON");
p->hThemeToolbar = xpt_AddThemeHandle(p->hwnd, L"TOOLBAR");
- WindowList_Add(hButtonWindowList, hWnd, 0);
+ WindowList_Add(hButtonWindowList, hWnd);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index f2917ad03c..bf0550e8e5 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -87,7 +87,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM {
MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, false);
assert(hWL);
- WindowList_Add(hWL, hDlg, NULL);
+ WindowList_Add(hWL, hDlg);
Window_SetIcon_IcoLib(hDlg, Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER));
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index f60d68359b..303fa5366c 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -165,7 +165,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // set icons
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("main"));
- WindowList_Add(hWindowList, hwndDlg, NULL);
+ WindowList_Add(hWindowList, hwndDlg);
ShowWindow(hwndDlg, SW_SHOW);
break;
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index a9f2b162ca..d26db00f7b 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -857,7 +857,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa } case UM_INITPOPUP: //This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups. - WindowList_Add(YAMNVar.MessageWnds, hWnd, NULL); + WindowList_Add(YAMNVar.MessageWnds, hWnd); break; case UM_DESTROYPOPUP: WindowList_Remove(YAMNVar.MessageWnds, hWnd); @@ -949,7 +949,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l return FALSE; case UM_INITPOPUP: //This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups. - WindowList_Add(YAMNVar.MessageWnds, hWnd, NULL); + WindowList_Add(YAMNVar.MessageWnds, hWnd); break; case UM_DESTROYPOPUP: WindowList_Remove(YAMNVar.MessageWnds, hWnd); @@ -1282,8 +1282,6 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nullptr != iValueW) delete[] iValueW; - //WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL); - //WindowList_Add(YAMNVar.NewMailAccountWnd,hDlg,ActualAccount); SendMessage(hDlg, WM_YAMN_CHANGECONTENT, 0, (LPARAM)MailParam); MoveWindow(hDlg, HeadPosX, HeadPosY, HeadSizeX, HeadSizeY, 0); ShowWindow(hDlg, SW_SHOWNORMAL); @@ -1607,7 +1605,7 @@ void __cdecl ShowEmailThread(void *Param) else { CREADTEVIEWMESSAGEWINDOW: MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam); - WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow, NULL); + WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow); MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { if (MyParam.mail->MsgWindow == nullptr || !IsDialogMessage(MyParam.mail->MsgWindow, &msg)) { /* Wine fix. */ @@ -1673,7 +1671,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR ReadDoneFcn(ActualAccount->AccountAccessSO); - WindowList_Add(YAMNVar.MessageWnds, hDlg, NULL); + WindowList_Add(YAMNVar.MessageWnds, hDlg); WindowList_Add(YAMNVar.NewMailAccountWnd, hDlg, (UINT_PTR)ActualAccount); { diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 33a679651a..07889eaee3 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -665,7 +665,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Remove(pYAMNVar->MessageWnds, hDlg);
SendMessage(GetParent(hDlg), PSM_UNCHANGED, (WPARAM)hDlg, 0);
}
- else WindowList_Add(pYAMNVar->MessageWnds, hDlg, NULL);
+ else WindowList_Add(pYAMNVar->MessageWnds, hDlg);
return TRUE;
case WM_YAMN_CHANGESTATUS:
@@ -1177,7 +1177,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(GetParent(hDlg), PSM_UNCHANGED, (WPARAM)hDlg, 0);
}
else {
- WindowList_Add(pYAMNVar->MessageWnds, hDlg, NULL);
+ WindowList_Add(pYAMNVar->MessageWnds, hDlg);
int index = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0);
HPOP3ACCOUNT temp = ActualAccount;
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index d35e8478d2..d3c92eee22 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -254,7 +254,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam switch (uMsg) {
case WM_CREATE:
- WindowList_Add(hClcWindowList, hwnd, 0);
+ WindowList_Add(hClcWindowList, hwnd);
cli.pfnRegisterFileDropping(hwnd);
if (dat == nullptr) {
dat = new ClcData();
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 787187f616..6fef3ccdab 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -229,7 +229,7 @@ void PROTO_INTERFACE::WindowSubscribe(HWND hwnd) if (m_hWindowList == nullptr)
m_hWindowList = WindowList_Create();
- WindowList_Add(m_hWindowList, hwnd, 0);
+ WindowList_Add(m_hWindowList, hwnd);
}
void PROTO_INTERFACE::WindowUnsubscribe(HWND hwnd)
diff --git a/src/mir_core/src/windowlist.cpp b/src/mir_core/src/windowlist.cpp index f997352fe9..8d150fda2c 100644 --- a/src/mir_core/src/windowlist.cpp +++ b/src/mir_core/src/windowlist.cpp @@ -26,12 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct TWindowListItem
{
- TWindowListItem(MCONTACT _contact, HWND _wnd) :
- hContact(_contact),
+ TWindowListItem(UINT_PTR _param, HWND _wnd) :
+ param(_param),
hWnd(_wnd)
{}
- MCONTACT hContact;
+ UINT_PTR param;
HWND hWnd;
};
@@ -53,12 +53,12 @@ MIR_CORE_DLL(void) WindowList_Destroy(MWindowList &hList) hList = nullptr;
}
-MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact)
+MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, UINT_PTR param)
{
if (hList == nullptr)
return 1;
- hList->insert(new TWindowListItem(hContact, hwnd));
+ hList->insert(new TWindowListItem(param, hwnd));
return 0;
}
@@ -75,12 +75,12 @@ MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd) return 1;
}
-MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact)
+MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, UINT_PTR param)
{
if (hList == nullptr)
return nullptr;
- TWindowListItem *p = hList->find((TWindowListItem*)&hContact);
+ TWindowListItem *p = hList->find((TWindowListItem*)¶m);
return (p == nullptr) ? nullptr : p->hWnd;
}
|