From 51b65d2c2e5f274a9ec3b04b372cc194f8dab0d3 Mon Sep 17 00:00:00 2001 From: xionglinlin Date: Fri, 13 Mar 2026 14:54:19 +0800 Subject: [PATCH] fix: prevent dock from hiding when hovering over preview windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was that when users hovered over application preview windows in the dock, the dock would automatically hide, causing the preview windows to appear floating without their parent dock. This happened because the preview windows were being incorrectly identified as tooltip windows and excluded from dock's event filtering logic. The fix adds a custom property "isDockPreview" to the preview window container to distinguish dock preview windows from regular tooltip windows. The DockHelper event filter now checks for this property before skipping tooltip windows, ensuring that dock preview windows continue to be processed by the dock's event system. Technical details: 1. Added property setting in X11WindowPreviewContainer::initUI() to mark the window as a dock preview 2. Modified DockHelper::eventFilter() to only skip tooltip windows that don't have the "isDockPreview" property set to true Log: Fixed dock auto-hiding issue when hovering over application preview windows Influence: 1. Test hovering over application preview windows in dock - dock should remain visible 2. Verify that regular tooltip windows still function normally and don't interfere with dock behavior 3. Test dock preview window display and interaction in different positions (top/bottom/left/right) 4. Verify that the fix works with multiple preview windows open simultaneously 5. Test with different application types and window states fix: 修复鼠标悬停在应用预览窗口时任务栏自动隐藏的问题 问题在于当用户悬停在任务栏中的应用预览窗口时,任务栏会自动隐藏,导致预 览窗口悬空显示而没有父级任务栏。这是因为预览窗口被错误地识别为工具提示窗 口,从而被排除在任务栏的事件过滤逻辑之外。 修复方案为预览窗口容器添加自定义属性"isDockPreview",以区分任务栏预览窗 口和常规工具提示窗口。DockHelper事件过滤器现在在跳过工具提示窗口之前会检 查此属性,确保任务栏预览窗口继续由任务栏的事件系统处理。 技术细节: 1. 在X11WindowPreviewContainer::initUI()中添加属性设置,将窗口标记为任务 栏预览窗口 2. 修改DockHelper::eventFilter(),仅跳过未设置"isDockPreview"属性为true 的工具提示窗口 Log: 修复鼠标悬停在应用预览窗口时任务栏自动隐藏的问题 Influence: 1. 测试悬停在任务栏中的应用预览窗口 - 任务栏应保持可见 2. 验证常规工具提示窗口仍能正常工作且不影响任务栏行为 3. 测试不同位置(顶部/底部/左侧/右侧)的任务栏预览窗口显示和交互 4. 验证修复在同时打开多个预览窗口时正常工作 5. 测试不同类型的应用程序和窗口状态 PMS: BUG-352855 Change-Id: I9e7dd425ce3dc887783bebfdf92acf61bca8c4ca --- panels/dock/dockhelper.cpp | 6 ++++-- panels/dock/taskmanager/x11preview.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/panels/dock/dockhelper.cpp b/panels/dock/dockhelper.cpp index 50a603a9a..bb089675b 100644 --- a/panels/dock/dockhelper.cpp +++ b/panels/dock/dockhelper.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -69,7 +69,9 @@ bool DockHelper::eventFilter(QObject *watched, QEvent *event) // skip tooltip windows if (window->flags().testFlags(Qt::ToolTip)) { - return false; + if (!window->property("isDockPreview").toBool()) { + return false; + } } auto topTransientParent = window; diff --git a/panels/dock/taskmanager/x11preview.cpp b/panels/dock/taskmanager/x11preview.cpp index 34e494b7d..6513ed377 100644 --- a/panels/dock/taskmanager/x11preview.cpp +++ b/panels/dock/taskmanager/x11preview.cpp @@ -695,6 +695,9 @@ void X11WindowPreviewContainer::initUI() setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); winId(); + if (auto handle = this->windowHandle()) { + handle->setProperty("isDockPreview", true); + } DPlatformHandle handler(this->windowHandle()); handler.setShadowRadius(12 * qApp->devicePixelRatio()); handler.setShadowColor(QColor(0, 0, 0, 0.6 * 255));