From 6224b595b143a85ef30afaf365c0f15408be3dcb Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Wed, 5 Aug 2026 13:55:57 +0800 Subject: [PATCH] fix: prevent launcher popup blocking when hiding taskbar menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. 测试单屏和多屏显示配置下的表现 --- launchercontroller.cpp | 24 +++++++++++++++++++++++- launchercontroller.h | 3 ++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/launchercontroller.cpp b/launchercontroller.cpp index 58b17cb0..81fac513 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -141,7 +141,29 @@ bool LauncherController::visible() const void LauncherController::setVisible(bool visible) { - if (visible == m_visible) return; + if (!visible && m_showPending) { + m_showPending = false; + return; + } + + if (visible == m_visible || (visible && m_showPending)) return; + + if (visible && QGuiApplicationPrivate::popupCount() > 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] { + if (!m_showPending) { + return; + } + + m_showPending = false; + setVisible(true); + }); + return; + } m_visible = visible; diff --git a/launchercontroller.h b/launchercontroller.h index 15954724..ea09d6ec 100644 --- a/launchercontroller.h +++ b/launchercontroller.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -86,6 +86,7 @@ class LauncherController : public QObject QTimer *m_timer; Launcher1Adaptor * m_launcher1Adaptor; bool m_visible; + bool m_showPending = false; QString m_currentFrame; QString m_currentScreen; bool m_pendingHide = false;