From 73dcc8be15c67e3ef7c10767886fcca676100424 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Jul 2024 20:42:27 +0300 Subject: fixes for various small quirks --- plugins/Clist_modern/src/modern_clc.cpp | 11 +++++------ plugins/Clist_modern/src/modern_clcutils.cpp | 2 +- src/mir_app/src/clistgroups.cpp | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 7dba34ffba..b682a8d783 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1207,11 +1207,11 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_INSERTION: - ClcContact *contact, *destcontact; - ClcGroup *group, *destgroup; { - BOOL NeedRename = FALSE; - wchar_t newName[128] = { 0 }; + wchar_t newName[128]; newName[0] = 0; + + ClcContact *contact, *destcontact; + ClcGroup *group, *destgroup; g_clistApi.pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); int i = g_clistApi.pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); if (i != -1 && group->groupId != destgroup->groupId) { @@ -1227,7 +1227,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, shortGroup = groupName; } if (shortGroup) { - NeedRename = TRUE; if (sourceGrName) mir_snwprintf(newName, L"%s\\%s", sourceGrName, shortGroup); else @@ -1239,7 +1238,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, int newIndex = Clist_GroupMoveBefore(contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); newIndex = newIndex ? newIndex : contact->groupId; - if (NeedRename) + if (newName[0]) Clist_GroupRename(newIndex, newName); } break; diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 73bbde84bc..5bcc28e9b1 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -341,7 +341,7 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) topItem = cliGetRowByIndex(dat, topItem, &topcontact, &topgroup); ok = 1; } - else if ((pt.y + dat->yScroll >= cliGetRowTopY(dat, hit + 1) - dat->insertionMarkHitHeight) + else if ((pt.y + dat->yScroll >= cliGetRowBottomY(dat, hit + 1) - dat->insertionMarkHitHeight) || (contact->type == CLCIT_GROUP && contact->group->bExpanded && contact->group->cl.getCount() > 0)) { //could be insertion mark (below) topItem = hit; bottomItem = hit + 1; diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index da236f8481..c4d4ed2dba 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -294,8 +294,7 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) } else { hGroupBefore--; - CGroupInternal *pDest = FindGroup(hGroupBefore); - if (pDest == nullptr) + if (!FindGroup(hGroupBefore)) return 0; if (hGroup < hGroupBefore) { -- cgit v1.2.3