From ed2c003f61566f1a80074cb9f949c874690f4450 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 May 2017 13:29:55 +0300 Subject: fix for clicking on arrow buttons --- src/mir_app/src/srmm_base.cpp | 2 +- src/mir_app/src/srmm_toolbar.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') 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); -- cgit v1.2.3