From f2a434a0b4809d0445b72c36e1f20030d96d31ad Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Dec 2021 18:58:46 +0300 Subject: fixes #2895 (Clist_modern: various quirks with embedded clists, metacontacts & drag-n-drops) --- plugins/Clist_modern/src/modern_clc.cpp | 32 ++++++++++++-------------------- plugins/Clist_modern/src/version.h | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 4 ++-- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 714ca0f799..d634744cd0 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -953,13 +953,15 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR } ClcContact *contSour, *contDest; + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); + if (contDest->type != CLCIT_INFO && contSour->type != CLCIT_INFO) switch (target) { case DROPTARGET_ONSELF: break; case DROPTARGET_ONCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->pce->szProto, META_PROTO)) { @@ -971,8 +973,6 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; case DROPTARGET_ONMETACONTACT: - cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->pce->szProto, META_PROTO)) { @@ -986,8 +986,6 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR break; case DROPTARGET_ONSUBCONTACT: - cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->pce->szProto, META_PROTO)) { @@ -1075,23 +1073,29 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } else if (hitcontact == nullptr) ReleaseCapture(); + KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); if (dat->dragStage == (DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME)) CLUI_SafeSetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), nullptr); else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { wchar_t Wording[500]; - ClcContact *contDest, *contSour; + POINT pt = UNPACK_POINT(lParam); int target = GetDropTargetInformation(hwnd, dat, pt); + + ClcContact *contDest, *contSour; + cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); + cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); + + if (contDest->type != CLCIT_INFO && contSour->type != CLCIT_INFO) switch (target) { case DROPTARGET_ONSELF: break; case DROPTARGET_ONCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); - cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; + if (contSour->type == CLCIT_CONTACT) { MCONTACT hcontact = contSour->hContact; if (mir_strcmp(contSour->pce->szProto, META_PROTO)) { @@ -1126,8 +1130,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONMETACONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); - cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT) { @@ -1168,8 +1170,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONSUBCONTACT: - cliGetRowByIndex(dat, dat->iDragItem, &contSour, nullptr); - cliGetRowByIndex(dat, dat->selection, &contDest, nullptr); if (contSour->isChat() || contDest->isChat()) break; if (contSour->type == CLCIT_CONTACT) { @@ -1203,10 +1203,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } break; - case DROPTARGET_ONGROUP: - corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - break; - case DROPTARGET_INSERTION: ClcContact *contact, *destcontact; ClcGroup *group, *destgroup; @@ -1245,10 +1241,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } break; - case DROPTARGET_OUTSIDE: - corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - break; - default: corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); break; diff --git a/plugins/Clist_modern/src/version.h b/plugins/Clist_modern/src/version.h index 04c33a3fbc..abea33c11d 100644 --- a/plugins/Clist_modern/src/version.h +++ b/plugins/Clist_modern/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 #define __RELEASE_NUM 1 -#define __BUILD_NUM 11 +#define __BUILD_NUM 12 #include diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index fcdcc1ca5e..9df4fd1f6a 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1043,8 +1043,8 @@ class COptTypingDlg : public CDlgBase } public: - COptTypingDlg() - : CDlgBase(g_plugin, IDD_OPT_MSGTYPE), + COptTypingDlg() : + CDlgBase(g_plugin, IDD_OPT_MSGTYPE), urlHelp(this, IDC_MTN_HELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Advanced_tweaks"), m_clist(this, IDC_CLIST), chkWin(this, IDC_TYPEWIN), -- cgit v1.2.3