summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-05-04 13:29:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-05-04 13:29:55 +0300
commited2c003f61566f1a80074cb9f949c874690f4450 (patch)
tree33cd64568e8bd5006cf9093bd3c4d4a2e80a6a19 /src
parent8f90d307468f43f117cb5ca826187105ca5e1279 (diff)
fix for clicking on arrow buttons
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/srmm_base.cpp2
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp18
2 files changed, 13 insertions, 7 deletions
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 91040e3ecb..9f61d324fa 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -620,7 +620,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
if (wParam >= MIN_CBUTTONID && wParam <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(m_hContact, wParam, GetDlgItem(m_hwnd, wParam), 0);
+ Srmm_ClickToolbarIcon(m_hContact, wParam, m_hwnd, 0);
return 0;
}
break;
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 96ea229d53..2cf4504354 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -277,30 +277,36 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi)
return 0;
}
-MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, DWORD idFrom, HWND hwndFrom, BOOL code)
+MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, DWORD idFrom, HWND hwndDlg, BOOL code)
{
- RECT rc;
- GetWindowRect(hwndFrom, &rc);
-
bool bFromArrow = false;
+ HWND hwndFrom = nullptr;
CustomButtonClickData cbcd = {};
- cbcd.pt.x = rc.left;
- cbcd.pt.y = rc.bottom;
for (int i = 0; i < arButtonsList.getCount(); i++) {
CustomButtonData *cbd = arButtonsList[i];
if (cbd->m_dwButtonCID == idFrom) {
cbcd.pszModule = cbd->m_pszModuleName;
cbcd.dwButtonId = cbd->m_dwButtonOrigID;
+ hwndFrom = GetDlgItem(hwndDlg, idFrom);
}
else if (cbd->m_dwArrowCID == idFrom) {
bFromArrow = true;
cbcd.pszModule = cbd->m_pszModuleName;
cbcd.dwButtonId = cbd->m_dwButtonOrigID;
+ hwndFrom = GetDlgItem(hwndDlg, idFrom-1);
}
}
+ if (hwndFrom == nullptr)
+ return;
+
+ RECT rc;
+ GetWindowRect(hwndFrom, &rc);
+ cbcd.pt.x = rc.left;
+ cbcd.pt.y = rc.bottom;
+
cbcd.hwndFrom = GetParent(hwndFrom);
cbcd.hContact = hContact;
cbcd.flags = (code ? BBCF_RIGHTBUTTON : 0) | (GetKeyState(VK_SHIFT) & 0x8000 ? BBCF_SHIFTPRESSED : 0) | (GetKeyState(VK_CONTROL) & 0x8000 ? BBCF_CONTROLPRESSED : 0) | (bFromArrow ? BBCF_ARROWCLICKED : 0);