fix: prevent dock from hiding when hovering over preview windows#1501
fix: prevent dock from hiding when hovering over preview windows#1501deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMarks dock preview windows with a custom property and updates the dock event filter so preview windows are not treated as regular tooltips, preventing the dock from auto-hiding when hovering over previews. Sequence diagram for dock event filtering of preview vs tooltip windowssequenceDiagram
actor User
participant DockPreviewWindow
participant DockHelper
participant Dock
User->>DockPreviewWindow: Hover over preview
DockPreviewWindow-->>DockHelper: QEvent(Hover/Enter)
DockHelper->>DockHelper: eventFilter(watched, event)
DockHelper->>DockPreviewWindow: window = qobject_cast<QWindow*>(watched)
DockHelper->>DockHelper: check window->flags().testFlags(Qt::ToolTip)
alt Tooltip window without isDockPreview
DockHelper->>DockPreviewWindow: window->property(isDockPreview) == false
DockHelper-->>DockPreviewWindow: return false (skip filtering)
Dock-->>User: Dock may auto hide
else Dock preview window
DockHelper->>DockPreviewWindow: window->property(isDockPreview) == true
DockHelper-->>DockPreviewWindow: continue processing event
DockHelper->>Dock: Update visibility state (remain visible)
Dock-->>User: Dock stays visible while hovering preview
end
Class diagram for DockHelper and X11WindowPreviewContainer changesclassDiagram
class DockHelper {
+bool eventFilter(QObject *watched, QEvent *event)
}
class X11WindowPreviewContainer {
+void initUI()
}
class QWindow {
+Qt::WindowFlags flags()
+QVariant property(const char *name)
+void setProperty(const char *name, const QVariant &value)
}
class QEvent
class QObject
DockHelper ..|> QObject
X11WindowPreviewContainer ..|> QObject
X11WindowPreviewContainer --> QWindow : uses windowHandle()
DockHelper --> QWindow : filters events for
DockHelper --> QEvent
note for X11WindowPreviewContainer "initUI sets windowHandle property isDockPreview = true on the preview window"
note for DockHelper "eventFilter skips Qt::ToolTip windows only when isDockPreview is not true"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider defining the "isDockPreview" property name as a shared constexpr/QStringLiteral (e.g., in a common header) instead of repeating the raw string in multiple places to avoid typos and ease future changes.
- In DockHelper::eventFilter, you could early-return when the window has the isDockPreview property set (before further transient/parent handling) to make the special-case behavior for previews more explicit and reduce unnecessary processing.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider defining the "isDockPreview" property name as a shared constexpr/QStringLiteral (e.g., in a common header) instead of repeating the raw string in multiple places to avoid typos and ease future changes.
- In DockHelper::eventFilter, you could early-return when the window has the isDockPreview property set (before further transient/parent handling) to make the special-case behavior for previews more explicit and reduce unnecessary processing.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这段代码主要涉及对Dock(任务栏)预览窗口的事件过滤处理和属性设置。以下是对这段diff的详细审查意见: 1. 代码逻辑审查关于
关于
2. 代码质量与规范
3. 代码性能
4. 代码安全
5. 改进建议为了提高代码的可读性和健壮性,建议进行以下微调: 建议一:优化
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wjyrich, xionglinlin 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 |
|
/forcemerge |
|
This pr force merged! (status: behind) |
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:
Log: Fixed dock auto-hiding issue when hovering over application preview windows
Influence:
fix: 修复鼠标悬停在应用预览窗口时任务栏自动隐藏的问题
问题在于当用户悬停在任务栏中的应用预览窗口时,任务栏会自动隐藏,导致预
览窗口悬空显示而没有父级任务栏。这是因为预览窗口被错误地识别为工具提示窗
口,从而被排除在任务栏的事件过滤逻辑之外。
修复方案为预览窗口容器添加自定义属性"isDockPreview",以区分任务栏预览窗
口和常规工具提示窗口。DockHelper事件过滤器现在在跳过工具提示窗口之前会检
查此属性,确保任务栏预览窗口继续由任务栏的事件系统处理。
技术细节:
Log: 修复鼠标悬停在应用预览窗口时任务栏自动隐藏的问题
Influence:
PMS: BUG-352855
Change-Id: I9e7dd425ce3dc887783bebfdf92acf61bca8c4ca
Summary by Sourcery
Ensure dock preview windows are correctly handled by the dock event system so the dock stays visible when hovering previews.
Bug Fixes:
Enhancements:
Chores: