Fix: keep the floating toolbar open while its quality menu is up
With the toolbar unpinned, CheckMousePosition() runs from the full-screen timer every 50ms and slides the bar out once the cursor leaves the edge band. The quality menu drops from the button's bottom edge, so its first item already sits past the monTop + m_nHeight + 10 threshold: the bar retracted the moment the user moved onto the menu, taking the menu with it. A m_bMenuOpen flag now suspends the retract decision while TrackPopupMenu is running. The menu's modal loop still dispatches the parent's WM_TIMER, so without this the bar animates away under it. The flag is set and cleared around the call, so behaviour is unchanged once the menu closes or is dismissed with Esc. Only the quality menu opens a popup, so nothing else needed the flag. Verified: debug server build, 0 errors, ToolbarDlg.cpp rebuilt. UI not exercised.
This commit is contained in:
1 parent
6b87a31c6f
commit
49ba0c4850
2 files changed
+17
No files matched your search
@@ -79,6 +79,15 @@ void CToolbarDlg::CheckMousePosition()
|
||||
return;
|
||||
}
|
||||
|
||||
// 菜单开着时不做缩回判定:菜单会展开到屏幕中间,鼠标跟着离开边缘区域,
|
||||
// 按下面的逻辑就会 SlideOut,工具栏一藏菜单也就没了。
|
||||
if (m_bMenuOpen) {
|
||||
if (!m_bVisible) {
|
||||
SlideIn();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CPoint pt;
|
||||
GetCursorPos(&pt);
|
||||
|
||||
@@ -722,7 +731,11 @@ void CToolbarDlg::OnBnClickedQuality()
|
||||
// 弹出菜单
|
||||
CRect rc;
|
||||
m_btnQuality.GetWindowRect(&rc);
|
||||
// 菜单开着期间禁止自动缩回:TrackPopupMenu 是模态循环,父窗口的 WM_TIMER 照常
|
||||
// 派发,鼠标移到菜单上就算"离开边缘",工具栏缩回去菜单也跟着消失。
|
||||
m_bMenuOpen = true;
|
||||
UINT cmd = menu.TrackPopupMenu(TPM_RETURNCMD | TPM_NONOTIFY, rc.right, rc.top, this);
|
||||
m_bMenuOpen = false;
|
||||
if (cmd) {
|
||||
GetParent()->PostMessage(WM_SYSCOMMAND, cmd, 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user