fix: close popups before showing launchpad - #790
Conversation
There was a problem hiding this comment.
Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideImplements deferred launcher visibility changes to ensure all Qt popups are closed and their Wayland grabs released before showing the launchpad, using a pending-show flag and a zero-timeout timer callback. Sequence diagram for deferred launcher visibility when popups are opensequenceDiagram
participant Caller
participant LauncherController
participant QGuiApplicationPrivate
participant QTimer
Caller->>LauncherController: setVisible(true)
LauncherController->>QGuiApplicationPrivate: popupCount()
QGuiApplicationPrivate-->>LauncherController: popupCount > 0
LauncherController->>LauncherController: m_showPending = true
LauncherController->>LauncherController: closeAllPopups()
LauncherController->>QTimer: singleShot(0, this, lambda)
QTimer-->>LauncherController: lambda callback
alt m_showPending is true
LauncherController->>LauncherController: m_showPending = false
LauncherController->>LauncherController: setVisible(true)
else m_showPending is false
LauncherController->>LauncherController: [return]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
在x11和wayland下,任务栏上的右键菜单弹出后,再用快捷键启动小启动器,菜单不消失, |
1. Add m_showPending flag to track deferred launcher show requests 2. When a show request arrives while popups are open, close all popups first and defer the launcher display 3. Use a QTimer::singleShot(0) to let Qt properly finish hiding popups and release the Wayland popup grab before mapping the launcher window 4. On hide requests, clear the pending show flag to avoid conflicts with the deferred show operation 5. Prevent redundant show calls while a show is already pending 6. Update SPDX copyright year to 2026 in the header file Log: Fixed the issue where the taskbar right-click context menu would not disappear when launching the launcher via keyboard shortcut on X11 and Wayland Influence: 1. On X11: open taskbar context menu via right-click, then press the launcher shortcut key, verify the menu closes and the launcher opens 2. On Wayland: repeat the same test and verify smooth transition from menu to launcher 3. Test repeatedly triggering the shortcut key while popups are open, verify no stale launcher state occurs 4. Test hiding the launcher immediately after showing it (rapid show/ hide), verify no pending-show state inconsistency 5. Test launching the launcher when no popup is open, verify normal behavior remains unchanged 6. Test in both single and multi-screen display configurations fix: 修复隐藏任务栏菜单时启动器弹窗阻塞问题 1. 添加 m_showPending 标志用于跟踪延迟的启动器显示请求 2. 当弹出菜单打开时收到显示请求,先关闭所有弹出菜单并延迟启动器显示 3. 使用 QTimer::singleShot(0) 让 Qt 先完成弹出窗口的隐藏和释放 Wayland 弹出抓取,然后才映射启动器窗口 4. 收到隐藏请求时清除待显示标志,避免与延迟显示操作冲突 5. 防止已有待显示操作时重复触发显示调用 6. 将头文件中的 SPDX 版权年份更新为 2026 Log: 修复在 X11 和 Wayland 下通过快捷键启动小启动器时任务栏右键菜单不消 失的问题 Influence: 1. 在 X11 下:右键打开任务栏上下文菜单,然后按下启动器快捷键,验证菜单关 闭且启动器正常打开 2. 在 Wayland 下:重复相同测试,验证菜单到启动器的切换过程流畅无异常 3. 在弹出菜单打开时反复触发快捷键,验证不产生启动器状态残留 4. 显示启动器后立即隐藏(快速显示/隐藏),验证无待显示状态不一致 5. 在没有弹出菜单打开时启动启动器,验证正常行为不受影响 6. 测试单屏和多屏显示配置下的表现
deepin pr auto review★ 总体评分:85分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 void LauncherController::setVisible(bool visible)
{
if (!visible && m_showPending) {
m_showPending = false;
return;
}
if (visible == m_visible || (visible && m_showPending)) return;
// 替换私有API调用,通过遍历顶层窗口检测Popup
auto getPopupCount = []() {
int count = 0;
const auto topWidgets = QGuiApplication::topLevelWidgets();
for (QWidget *w : topWidgets) {
if (w->windowType() == Qt::Popup && w->isVisible()) {
++count;
}
}
return count;
};
if (visible && getPopupCount() > 0) {
m_showPending = true;
closeAllPopups();
// Let Qt finish hiding the current popup and release the Wayland
// popup grab before the launcher window is mapped.
QTimer::singleShot(0, this, [this, getPopupCount] {
if (!m_showPending) {
return;
}
// 增加二次检查,防止极端情况下新的Popup产生
if (getPopupCount() > 0) {
QTimer::singleShot(0, this, [this] {
if (!m_showPending) return;
m_showPending = false;
setVisible(true);
});
return;
}
m_showPending = false;
setVisible(true);
});
return;
}
m_visible = visible;
// ... (后续原有逻辑)
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary by Sourcery
Bug Fixes: