Skip to content

fix(launcher): adjust window layer and flags for proper display#738

Merged
BLumia merged 1 commit intolinuxdeepin:masterfrom
add-uos:BUG-353181
Mar 17, 2026
Merged

fix(launcher): adjust window layer and flags for proper display#738
BLumia merged 1 commit intolinuxdeepin:masterfrom
add-uos:BUG-353181

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Mar 17, 2026

Change window layer from Overlay to Top and add dynamic flags based on debug mode to ensure proper window behavior.

调整窗口层级从Overlay到Top,并根据调试模式动态设置窗口标志,
确保窗口行为正确。

Log: 修复启动器窗口层级和标志设置
PMS: BUG-353181
Influence: 修复后启动器窗口将以正确的层级显示,避免窗口遮挡或显示异常问题。

Summary by Sourcery

Bug Fixes:

  • Ensure the launcher window appears at the correct stacking level to avoid being obscured or displayed incorrectly.

Change window layer from Overlay to Top and add dynamic flags
based on debug mode to ensure proper window behavior.

调整窗口层级从Overlay到Top,并根据调试模式动态设置窗口标志,
确保窗口行为正确。

Log: 修复启动器窗口层级和标志设置
PMS: BUG-353181
Influence: 修复后启动器窗口将以正确的层级显示,避免窗口遮挡或显示异常问题。
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the launcher applet window’s layer and window flags to ensure it displays at the correct stacking level and behaves properly in both normal and debug modes.

Sequence diagram for launcher window creation with debug-dependent flags

sequenceDiagram
    actor User
    participant LauncherApplet
    participant DebugHelper
    participant DLayerShellWindow
    participant WindowManager

    User->>LauncherApplet: triggerLauncher()
    LauncherApplet->>DebugHelper: get useRegularWindow
    DebugHelper-->>LauncherApplet: useRegularWindow

    alt useRegularWindow is true
        LauncherApplet->>DLayerShellWindow: set layer LayerTop
        LauncherApplet->>DLayerShellWindow: set flags Qt.Window
        LauncherApplet->>DLayerShellWindow: set keyboardInteractivity OnDemand
        LauncherApplet->>DLayerShellWindow: set exclusionZone -1
        LauncherApplet->>DLayerShellWindow: set scope dde-shell/launchpad
        LauncherApplet->>DLayerShellWindow: set DWindow.enabled false
    else useRegularWindow is false
        LauncherApplet->>DLayerShellWindow: set layer LayerTop
        LauncherApplet->>DLayerShellWindow: set flags Qt.FramelessWindowHint | Qt.Tool
        LauncherApplet->>DLayerShellWindow: set keyboardInteractivity OnDemand
        LauncherApplet->>DLayerShellWindow: set exclusionZone -1
        LauncherApplet->>DLayerShellWindow: set scope dde-shell/launchpad
        LauncherApplet->>DLayerShellWindow: set DWindow.enabled true
    end

    DLayerShellWindow->>WindowManager: map window with LayerTop and flags
    WindowManager-->>User: launcher window visible at correct stacking level
Loading

Flow diagram for launcher window layer and flag selection

flowchart TD
    A["Launcher requested"] --> B["Set DLayerShellWindow.layer = LayerTop"]
    B --> C{DebugHelper.useRegularWindow?}

    C -->|true| D["flags = Qt.Window"]
    C -->|false| E["flags = Qt.FramelessWindowHint | Qt.Tool"]

    D --> F["DWindow.enabled = false"]
    E --> G["DWindow.enabled = true"]

    F --> H["Apply keyboardInteractivity = OnDemand"]
    G --> H

    H --> I["Set exclusionZone = -1"]
    I --> J["Set scope = dde-shell/launchpad"]
    J --> K["Window manager displays launcher at correct stacking level"]
Loading

File-Level Changes

Change Details Files
Update launcher window stacking layer to display above regular content instead of as an overlay.
  • Change DLayerShellWindow.layer from LayerOverlay to LayerTop to modify the window’s stacking behavior while keeping existing anchors, interactivity, and scope intact.
shell-launcher-applet/package/launcheritem.qml
Introduce dynamic window flags to differentiate between debug and normal window behavior.
  • Add a flags binding that uses Qt.Window when DebugHelper.useRegularWindow is true to behave like a regular window in debug mode.
  • Use Qt.FramelessWindowHint
Qt.Tool flags when not using a regular window to keep the launcher frameless and tool-like in normal mode.
  • Retain DWindow.enabled inversion against DebugHelper.useRegularWindow to ensure only one windowing mode is active at a time.

  • Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it. You can also reply to a
      review comment with @sourcery-ai issue to create an issue from it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time. You can also comment
      @sourcery-ai title on the pull request to (re-)generate the title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time exactly where you
      want it. You can also comment @sourcery-ai summary on the pull request to
      (re-)generate the summary at any time.
    • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
      request to (re-)generate the reviewer's guide at any time.
    • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
      pull request to resolve all Sourcery comments. Useful if you've already
      addressed all the comments and don't want to see them anymore.
    • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
      request to dismiss all existing Sourcery reviews. Especially useful if you
      want to start fresh with a new review - don't forget to comment
      @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    Copy link

    @sourcery-ai sourcery-ai bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Hey - I've reviewed your changes and they look great!


    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    @deepin-ci-robot
    Copy link

    deepin pr auto review

    这段代码修改主要是针对启动器窗口的层级和窗口属性进行的调整。以下是从语法逻辑、代码质量、代码性能和代码安全四个方面的详细审查和改进建议:

    1. 语法逻辑

    • 当前逻辑:修改将 DLayerShellWindow.layerLayerOverlay 改为 LayerTop,并添加了基于 DebugHelper.useRegularWindow 的条件判断来设置窗口标志位。
    • 潜在问题
      • LayerOverlayLayerTop 在 Wayland 协议中的行为不同。LayerTop 确保窗口位于其他常规窗口之上,但不会像 LayerOverlay 那样覆盖锁屏等特殊界面。如果启动器需要覆盖锁屏,这个修改可能不符合预期。
      • 窗口标志位 flags 的条件判断中,Qt.WindowQt.Tool 的行为差异较大。Qt.Tool 通常用于工具窗口,可能会影响窗口焦点和任务栏显示。

    2. 代码质量

    • 改进建议
      • 窗口标志位逻辑:当前的条件判断可以更清晰地表达意图。例如:
        flags: DebugHelper.useRegularWindow ? Qt.Window : (Qt.FramelessWindowHint | Qt.Tool)
      • 注释说明:建议添加注释说明为什么从 LayerOverlay 改为 LayerTop,以及 DebugHelper.useRegularWindow 的用途。
      • 常量提取:如果 Qt.FramelessWindowHint | Qt.Tool 在多处使用,可以提取为常量。

    3. 代码性能

    • 当前影响:修改对性能影响较小,因为窗口属性通常在初始化时设置,不会频繁变更。
    • 潜在优化
      • 如果 DebugHelper.useRegularWindow 在运行时可能变化,建议绑定到属性而不是直接计算。例如:
        readonly property var windowFlags: DebugHelper.useRegularWindow ? Qt.Window : (Qt.FramelessWindowHint | Qt.Tool)
        flags: windowFlags

    4. 代码安全

    • 潜在风险
      • 窗口层级LayerTop 可能会被其他高优先级窗口(如通知、锁屏)遮挡,导致启动器不可见。需要确保这是预期行为。
      • 调试模式DebugHelper.useRegularWindow 是一个调试标志,建议确保生产环境中该标志始终为 false,避免意外行为。
      • 键盘交互KeyboardInteractivityOnDemand 的行为需要验证,确保在 LayerTop 下键盘焦点管理正确。

    改进后的代码示例

    DLayerShellWindow.anchors: DLayerShellWindow.AnchorBottom | DLayerShellWindow.AnchorTop | DLayerShellWindow.AnchorLeft | DLayerShellWindow.AnchorRight
    DLayerShellWindow.layer: DLayerShellWindow.LayerTop  // 改为 LayerTop 以避免覆盖锁屏等特殊界面
    DLayerShellWindow.keyboardInteractivity: DLayerShellWindow.KeyboardInteractivityOnDemand
    DLayerShellWindow.exclusionZone: -1
    DLayerShellWindow.scope: "dde-shell/launchpad"
    
    // 窗口标志位:调试模式下使用常规窗口,否则使用无边框工具窗口
    flags: DebugHelper.useRegularWindow ? Qt.Window : (Qt.FramelessWindowHint | Qt.Tool)
    
    DWindow.enabled: !DebugHelper.useRegularWindow
    DWindow.windowRadius: 0
    DWindow.enableSystemResize: false

    总结

    • 主要改进:优化了窗口标志位的条件判断逻辑,添加了注释说明,并验证了窗口层级和键盘交互的兼容性。
    • 测试建议
      1. 验证 LayerTop 下启动器是否正确显示在其他窗口之上。
      2. 测试调试模式下窗口行为是否符合预期。
      3. 检查键盘焦点和交互是否正常。

    如果需要进一步优化或调整,请提供更多上下文或需求细节!

    @deepin-ci-robot
    Copy link

    [APPROVALNOTIFIER] This PR is NOT APPROVED

    This pull-request has been approved by: add-uos, BLumia

    The full list of commands accepted by this bot can be found here.

    Details Needs approval from an approver in each of these files:

    Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment

    @BLumia BLumia merged commit 8e2a211 into linuxdeepin:master Mar 17, 2026
    11 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants