summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-29 15:32:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-29 15:32:53 +0300
commita84f13194da3bd7ba45d5edd84229043369f2324 (patch)
treec5223f1f51e31e6cda4248b11d36695cf6a08708 /src
parent5394d950df535693ae1cf85ef3cc049810f1f23b (diff)
fix for menu position calculation
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/CCtrlListBox.cpp10
-rw-r--r--src/mir_core/src/CCtrlListView.cpp5
-rw-r--r--src/mir_core/src/CCtrlTreeView.cpp8
3 files changed, 14 insertions, 9 deletions
diff --git a/src/mir_core/src/CCtrlListBox.cpp b/src/mir_core/src/CCtrlListBox.cpp
index 34980c05a3..da75fefe19 100644
--- a/src/mir_core/src/CCtrlListBox.cpp
+++ b/src/mir_core/src/CCtrlListBox.cpp
@@ -47,12 +47,14 @@ void CCtrlListBox::GetCaretPos(CContextMenuPos &pos) const
if (pos.iCurr != -1) {
RECT rc;
GetItemRect(pos.iCurr, &rc);
- pos.pt.x = rc.left;
- pos.pt.y = rc.top;
+ pos.pt.x = rc.left + 8;
+ pos.pt.y = rc.top + 8;
+ ClientToScreen(m_hwnd, &pos.pt);
+ return;
}
- else CSuper::GetCaretPos(pos);
}
- else CSuper::GetCaretPos(pos);
+
+ CSuper::GetCaretPos(pos);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_core/src/CCtrlListView.cpp b/src/mir_core/src/CCtrlListView.cpp
index 0156aeab6e..9573cc0b02 100644
--- a/src/mir_core/src/CCtrlListView.cpp
+++ b/src/mir_core/src/CCtrlListView.cpp
@@ -159,8 +159,9 @@ void CCtrlListView::GetCaretPos(CContextMenuPos &pos) const
if (pos.iCurr != -1) {
RECT rc;
GetItemRect(pos.iCurr, &rc, TRUE);
- pos.pt.x = rc.left;
- pos.pt.y = rc.top;
+ pos.pt.x = rc.left + 8;
+ pos.pt.y = rc.top + 8;
+ ClientToScreen(m_hwnd, &pos.pt);
return;
}
}
diff --git a/src/mir_core/src/CCtrlTreeView.cpp b/src/mir_core/src/CCtrlTreeView.cpp
index 3edabcd61a..056f149588 100644
--- a/src/mir_core/src/CCtrlTreeView.cpp
+++ b/src/mir_core/src/CCtrlTreeView.cpp
@@ -557,12 +557,13 @@ void CCtrlTreeView::GetCaretPos(CContextMenuPos &pos) const
HTREEITEM hItem = GetSelection();
if (hItem != nullptr) {
pos.pCtrl = this;
- pos.iCurr = (INT_PTR)hItem;
+ pos.hItem = hItem;
RECT rc;
GetItemRect(hItem, &rc, TRUE);
- pos.pt.x = rc.left;
- pos.pt.y = rc.top;
+ pos.pt.x = rc.left + 8;
+ pos.pt.y = rc.top + 8;
+ ClientToScreen(m_hwnd, &pos.pt);
return;
}
}
@@ -570,6 +571,7 @@ void CCtrlTreeView::GetCaretPos(CContextMenuPos &pos) const
else {
TVHITTESTINFO hti;
hti.pt = pos.pt;
+ ScreenToClient(m_hwnd, &hti.pt);
if (HitTest(&hti) && (hti.flags & TVHT_ONITEM)) {
pos.hItem = hti.hItem;
return;