fix: keep dock visible during multitask view#1589
Merged
wjyrich merged 1 commit intolinuxdeepin:masterfrom May 7, 2026
Merged
Conversation
Reviewer's GuideAdds a KWin DBus listener and a multitask view state flag to override dock auto-hide logic so the dock stays visible during multitask view and resumes normal behavior afterward. Sequence diagram for dock visibility during KWin multitask viewsequenceDiagram
actor User
participant KWin
participant DBusSessionBus
participant DockHelper
participant DockPanel
User->>KWin: EnterMultitaskView
KWin->>DBusSessionBus: emit MultitaskStateChanged(true)
DBusSessionBus->>DockHelper: MultitaskStateChanged(true)
activate DockHelper
DockHelper->>DockHelper: onMultitaskStateChanged(true)
DockHelper->>DockHelper: m_inMultitaskView = true
DockHelper->>DockHelper: checkNeedShowOrNot()
DockHelper->>DockPanel: setHideState(Show)
deactivate DockHelper
User->>KWin: ExitMultitaskView
KWin->>DBusSessionBus: emit MultitaskStateChanged(false)
DBusSessionBus->>DockHelper: MultitaskStateChanged(false)
activate DockHelper
DockHelper->>DockHelper: onMultitaskStateChanged(false)
DockHelper->>DockHelper: m_inMultitaskView = false
DockHelper->>DockHelper: checkNeedHideOrNot()
DockHelper->>DockPanel: setHideState(Hide or Show based on conditions)
deactivate DockHelper
Updated class diagram for DockHelper multitask state handlingclassDiagram
class DockHelper {
- bool m_inMultitaskView
- QHash~QScreen*, DockWakeUpArea*~ m_areas
- QHash~QWindow*, bool~ m_enters
- QHash~QWindow*, bool~ m_transientChildShows
+ DockHelper(DockPanel* parent)
+ void checkNeedHideOrNot()
+ void checkNeedShowOrNot()
+ void onMultitaskStateChanged(bool inMultitask)
- void initAreas()
+ DockPanel* parent()
}
class DockPanel {
+ void setHideState(HideState state)
}
class QDBusConnection {
+ static QDBusConnection sessionBus()
+ bool connect(QString service, QString path, QString interface, QString name, QObject* receiver, const char* slot)
}
DockHelper --> DockPanel : uses
DockHelper --> QDBusConnection : listens_via
QDBusConnection <.. DockHelper : sessionBus_connects_to_MultitaskStateChanged
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:
- The DBus connection to
org.kde.KWin.MultitaskStateChangedignores the return value and any potential errors; consider checking the success ofQDBusConnection::connectand at least logging failures so issues with the signal wiring are observable. - Right now
m_inMultitaskViewis only updated on the signal; if the dock starts while KWin is already in multitask view, the initial state may be wrong—consider querying the current multitask state on initialization to keep the dock in sync from startup. - The new DBus connect uses the old
SLOT()syntax; switching to the functor-based syntax (e.g.&DockHelper::onMultitaskStateChanged) would give compile‑time checking of the slot signature and be consistent with newer Qt style.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The DBus connection to `org.kde.KWin.MultitaskStateChanged` ignores the return value and any potential errors; consider checking the success of `QDBusConnection::connect` and at least logging failures so issues with the signal wiring are observable.
- Right now `m_inMultitaskView` is only updated on the signal; if the dock starts while KWin is already in multitask view, the initial state may be wrong—consider querying the current multitask state on initialization to keep the dock in sync from startup.
- The new DBus connect uses the old `SLOT()` syntax; switching to the functor-based syntax (e.g. `&DockHelper::onMultitaskStateChanged`) would give compile‑time checking of the slot signature and be consistent with newer Qt style.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1. Add DBus connection to listen for KWin multitask state changes (org.kde.KWin.MultitaskStateChanged signal) 2. Track multitask view state with m_inMultitaskView member variable 3. Override auto-hide behavior to show dock when entering multitask view 4. Ensure dock remains visible during multitask view and properly checks show/hide state when exiting Log: Fixed dock auto-hide behavior during multitask view Influence: 1. Test entering and exiting multitask view with dock auto-hide enabled 2. Verify dock remains visible during multitask view 3. Confirm dock returns to normal auto-hide behavior after exiting multitask view 4. Test multiple transitions between normal and multitask views 5. Verify no regression in dock auto-hide under normal conditions fix: 在多任务视图下保持任务栏可见 1. 添加 DBus 连接监听 KWin 多任务状态变化 (org.kde.KWin.MultitaskStateChanged 信号) 2. 使用 m_inMultitaskView 成员变量跟踪多任务视图状态 3. 重写自动隐藏行为,进入多任务视图时显示任务栏 4. 确保在多任务视图中任务栏保持可见,退出时正确检查显示/隐藏状态 Log: 修复多任务视图下任务栏自动隐藏问题 Influence: 1. 测试启用任务栏自动隐藏时进入和退出多任务视图 2. 验证在多任务视图下任务栏保持可见 3. 确认退出多任务视图后任务栏恢复正常自动隐藏行为 4. 测试正常视图和多任务视图之间的多次切换 5. 验证正常情况下任务栏自动隐藏功能没有回归 PMS: BUG-312371
deepin pr auto review这段代码实现了在多任务视图开启时强制显示 Dock 面板,并在多任务视图关闭时恢复原有的隐藏/显示逻辑的功能。整体逻辑是通顺的,但在代码规范、健壮性和安全性方面还有提升空间。 以下是详细的审查意见和改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码示例// dockhelper.h
class DockHelper : public QObject
{
// ...
private Q_SLOTS:
void onMultitaskStateChanged(bool inMultitask);
// ...
private:
static constexpr const char* KWIN_SERVICE = "org.kde.KWin";
static constexpr const char* KWIN_PATH = "/KWin";
static constexpr const char* KWIN_INTERFACE = "org.kde.KWin";
bool m_inMultitaskView = false;
// ...
};
// dockhelper.cpp
DockHelper::DockHelper(DockPanel *parent)
: QObject(parent)
{
// ... 初始化代码 ...
// 检查 DBus 连接是否成功
if (!QDBusConnection::sessionBus().connect(QString(),
QStringLiteral(KWIN_PATH),
QStringLiteral(KWIN_INTERFACE),
QStringLiteral("MultitaskStateChanged"),
this,
SLOT(onMultitaskStateChanged(bool)))) {
qWarning() << "Failed to connect to KWin MultitaskStateChanged signal";
}
// ...
}
void DockHelper::checkNeedHideOrNot()
{
// 性能优化:如果处于多任务视图,强制不隐藏,直接返回
if (m_inMultitaskView) {
return;
}
// 原有的计算 needHide 的逻辑
// ...
if (needHide)
parent()->setHideState(Hide);
}
void DockHelper::checkNeedShowOrNot()
{
// 性能优化:如果处于多任务视图,强制显示
if (m_inMultitaskView) {
parent()->setHideState(Show);
return;
}
// 原有的计算 needShow 的逻辑
// ...
if (needShow)
parent()->setHideState(Show);
}
void DockHelper::onMultitaskStateChanged(bool inMultitask)
{
// 状态未改变则不做处理
if (m_inMultitaskView == inMultitask) {
return;
}
m_inMultitaskView = inMultitask;
// 根据新状态触发检查
if (m_inMultitaskView) {
checkNeedShowOrNot();
} else {
checkNeedHideOrNot();
}
}总结这段代码主要的功能实现是正确的。主要的改进点在于:
|
robertkill
approved these changes
May 7, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: robertkill, wjyrich 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Fixed dock auto-hide behavior during multitask view
Influence:
fix: 在多任务视图下保持任务栏可见
Log: 修复多任务视图下任务栏自动隐藏问题
Influence:
PMS: BUG-312371
Summary by Sourcery
Bug Fixes: