diff options
author | George Hazan <ghazan@miranda.im> | 2017-05-04 13:29:55 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-05-04 13:29:55 +0300 |
commit | ed2c003f61566f1a80074cb9f949c874690f4450 (patch) | |
tree | 33cd64568e8bd5006cf9093bd3c4d4a2e80a6a19 | |
parent | 8f90d307468f43f117cb5ca826187105ca5e1279 (diff) |
fix for clicking on arrow buttons
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/srmm_toolbar.cpp | 18 |
5 files changed, 23 insertions, 17 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 07e9b64814..43f8cb8f44 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -251,12 +251,12 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (IsWindowVisible(hwndButton) || (cbd->m_bSeparator && !(cbd->m_bAutoHidden || cbd->m_bHidden))) lwidth += cbd->m_iButtonWidth + gap; if (!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton) && !cbd->m_bAutoHidden) - cbd->m_bAutoHidden = 1; + cbd->m_bAutoHidden = true; continue; } if (!cbd->m_bCanBeHidden && !cbd->m_bHidden && !(!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton) && !cbd->m_bAutoHidden)) { ShowWindow(hwndButton, SW_SHOW); - cbd->m_bAutoHidden = 0; + cbd->m_bAutoHidden = false; } if (!cbd->m_bSeparator && !IsWindowVisible(hwndButton) && !IsWindowEnabled(hwndButton) && !cbd->m_bAutoHidden) @@ -265,12 +265,12 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (cbd->m_bCanBeHidden && !cbd->m_bHidden && (cbd->m_bSeparator || !((!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton)) && !cbd->m_bAutoHidden))) { if (tempL + tempR > (rect.right - foravatar)) { ShowWindow(hwndButton, SW_HIDE); - cbd->m_bAutoHidden = 1; + cbd->m_bAutoHidden = true; tempL -= cbd->m_iButtonWidth + gap; } else if (cbd->m_bAutoHidden) { ShowWindow(hwndButton, SW_SHOW); - cbd->m_bAutoHidden = 0; + cbd->m_bAutoHidden = false; } } if (nullptr != hwndButton) /* Wine fix. */ @@ -301,12 +301,12 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (nullptr != hwndButton) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, rect.right - foravatar - rwidth + gap, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); if (!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton) && !cbd->m_bAutoHidden) - cbd->m_bAutoHidden = 1; + cbd->m_bAutoHidden = true; continue; } if (!cbd->m_bCanBeHidden && !cbd->m_bHidden && !((!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton)) && !cbd->m_bAutoHidden)) { ShowWindow(hwndButton, SW_SHOW); - cbd->m_bAutoHidden = 0; + cbd->m_bAutoHidden = false; } if (!cbd->m_bSeparator && !IsWindowVisible(hwndButton) && !IsWindowEnabled(hwndButton) && !cbd->m_bAutoHidden) @@ -315,12 +315,12 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (cbd->m_bCanBeHidden && !cbd->m_bHidden && (cbd->m_bSeparator || !((!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton)) && !cbd->m_bAutoHidden))) { if (tempL + tempR > (rect.right - foravatar)) { ShowWindow(hwndButton, SW_HIDE); - cbd->m_bAutoHidden = 1; + cbd->m_bAutoHidden = true; tempR -= cbd->m_iButtonWidth + gap; } else if (cbd->m_bAutoHidden) { ShowWindow(hwndButton, SW_SHOW); - cbd->m_bAutoHidden = 0; + cbd->m_bAutoHidden = false; } } diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index e8452307cb..0aa80fbfca 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1872,7 +1872,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { DWORD idFrom = GetDlgCtrlID((HWND)wParam); if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) - Srmm_ClickToolbarIcon(m_hContact, idFrom, (HWND)wParam, 1); + Srmm_ClickToolbarIcon(m_hContact, idFrom, m_hwnd, 1); } break; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 9ce6c0605a..74f738dd77 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2828,7 +2828,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) {
DWORD idFrom = GetDlgCtrlID((HWND)wParam);
if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(m_hContact, idFrom, (HWND)wParam, 1);
+ Srmm_ClickToolbarIcon(m_hContact, idFrom, m_hwnd, 1);
break;
}
}
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); |