Skip to content

Conversation

@yixinshark
Copy link
Contributor

@yixinshark yixinshark commented Sep 19, 2025

…also displayed in the Control Center

has no blur effect, multitasking view plugin can not display in dcc.

Log: as title
Pms: BUG-286917

Summary by Sourcery

Bug Fixes:

  • Use DWindowManagerHelper::hasBlurWindow() instead of hasComposite() to determine when to include the Multitasking View plugin, preventing it from appearing when blur effect is unavailable

@deepin-ci-robot
Copy link

deepin pr auto review

这段代码是一个git diff,显示了在dockdbusproxy.cpp文件中的一个修改。我将从语法逻辑、代码质量、性能和安全性几个方面进行分析:

语法逻辑分析

  • 原代码检查DWindowManagerHelper::instance()->hasComposite(),新代码改为检查DWindowManagerHelper::instance()->hasBlurWindow()
  • 这个修改改变了条件判断的逻辑,从检查"合成能力"改为检查"模糊窗口能力"
  • 逻辑上没有明显错误,但需要确认这个改变是否符合业务需求

代码质量分析

  • 代码格式保持一致,缩进和空格使用正确
  • 变量命名清晰(m_multitaskviewApplet, iteminfos等)
  • 注释缺失,建议添加注释说明为什么需要检查模糊窗口能力
  • 代码结构清晰,没有冗余代码

性能分析

  • DWindowManagerHelper::instance()是单例模式调用,性能开销小
  • hasBlurWindow()方法的调用频率不高,不会造成性能问题
  • 整体性能影响可以忽略不计

安全性分析

  • 指针检查m_multitaskviewApplet是否为空,防止空指针解引用
  • 使用Qt::DirectConnection确保方法同步调用,避免异步调用可能带来的问题

改进建议

  1. 添加注释说明为什么需要检查模糊窗口能力,而不是合成能力
  2. 考虑添加日志记录,方便调试和追踪这个条件判断的变化
  3. 如果hasBlurWindow()返回值与业务逻辑紧密相关,建议添加断言或错误处理,确保功能正确性
  4. 可以考虑将这个条件判断封装成一个有意义的函数名,提高代码可读性

例如,可以这样改进:

// 检查是否需要显示多任务视图插件(需要模糊窗口支持)
if (m_multitaskviewApplet && supportsBlurEffect()) {
    DockItemInfo info;
    if (QMetaObject::invokeMethod(m_multitaskviewApplet, "dockItemInfo", Qt::DirectConnection, qReturnArg(info))) {
        iteminfos.append(info);
    }
}

// 添加辅助函数提高可读性
bool DockDBusProxy::supportsBlurEffect() const {
    return DWindowManagerHelper::instance()->hasBlurWindow();
}

这样的修改可以提高代码的可维护性和可读性,同时保持原有功能不变。

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 there - 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.

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 19, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updated the condition for displaying the Multitasking View plugin in the Control Center to rely on blur effect support instead of generic compositing.

File-Level Changes

Change Details Files
Condition for showing multitasking view plugin switched from composite support to blur effect support
  • Replaced DWindowManagerHelper::instance()->hasComposite() with hasBlurWindow()
  • Adjusted if statement to gate plugin display on blur capability
panels/dock/dockdbusproxy.cpp

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

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, yixinshark

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

fixed when system has no blur effect, the Multitasking View plugin
 is also displayed in the Control Center

Log: as title
Pms: BUG-286917
@yixinshark
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Sep 22, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit a8dc260 into linuxdeepin:master Sep 22, 2025
6 of 8 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