perf: optimize dock network plugin panel height resizing frequency#531
Open
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
Open
perf: optimize dock network plugin panel height resizing frequency#531yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
Introduced a QTimer to debounce the updateSize calls within the DockContentWidget. This heavily reduces the number of layout and geometry calculation events fired to the compositor (max 1 per 150ms) when rapidly scanning and appending Wi-Fi hotspots, thereby fixing visual flickering issues in Wayland without leaving dead space. 性能:优化任务栏网络插件面板高度调整频率 在 DockContentWidget 内部引入了 QTimer 对 updateSize 调用进行节流 (防抖)处理。扫描并连续追加 Wi-Fi 热点时,大幅减少发往合成器的 布局与几何计算事件(受限于最多 150ms 一次),从而修复了 Wayland 下 因窗口频繁变尺寸而引发的闪烁问题,同时也完整保留了正常的自适应包 裹尺寸机制。 Log: optimize dock network plugin panel height resizing frequency
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIntroduces a debounced height recalculation mechanism for the dock network plugin panel using a QTimer, reducing frequent resize/layout events while preserving correct adaptive sizing behavior, especially to fix Wayland flicker when Wi-Fi hotspots list changes rapidly. Sequence diagram for debounced DockContentWidget height updatessequenceDiagram
participant NetView
participant DockContentWidget
participant QTimer
NetView->>DockContentWidget: updateSize()
alt widget not visible
DockContentWidget->>DockContentWidget: doUpdateSize()
DockContentWidget->>NetView: setMaxHeight(h)
else widget visible
DockContentWidget->>QTimer: start(150ms)
QTimer-->>DockContentWidget: timeout()
DockContentWidget->>DockContentWidget: doUpdateSize()
DockContentWidget->>NetView: setMaxHeight(h)
end
DockContentWidget->>DockContentWidget: showEvent(event)
DockContentWidget->>DockContentWidget: doUpdateSize()
DockContentWidget->>DockContentWidget: queued doUpdateSize()
DockContentWidget->>DockContentWidget: resize(size())
Class diagram for DockContentWidget debounce changesclassDiagram
class DockContentWidget {
QVBoxLayout* m_mainLayout
NetView* m_netView
int m_minHeight
JumpSettingButton* m_netSetBtn
JumpSettingButton* m_netCheckBtn
QTimer* m_updateTimer
DockContentWidget(NetView* netView)
void updateSize()
void doUpdateSize()
void showEvent(QShowEvent* event)
}
class NetView {
void setMaxHeight(int h)
int height()
void updateSize()
}
class JumpSettingButton {
int height()
bool isVisible()
}
class QTimer {
void setSingleShot(bool singleShot)
void setInterval(int msec)
void start()
signal timeout()
}
class QVBoxLayout {
QMargins contentsMargins()
}
class QMargins {
int top()
}
DockContentWidget --> NetView : uses
DockContentWidget --> JumpSettingButton : uses
DockContentWidget --> QTimer : debounces_updateSize
DockContentWidget --> QVBoxLayout : layout
QVBoxLayout --> QMargins : returns
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 replacing the hard-coded
150ms debounce interval with a named constant or configuration value to make the intent clearer and simplify future tuning. - If
doUpdateSizeis not meant to be called from outside this class, you could move it to the private section (or use a private slot) to avoid expanding the public API surface unnecessarily.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider replacing the hard-coded `150` ms debounce interval with a named constant or configuration value to make the intent clearer and simplify future tuning.
- If `doUpdateSize` is not meant to be called from outside this class, you could move it to the private section (or use a private slot) to avoid expanding the public API surface unnecessarily.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Introduced a QTimer to debounce the updateSize calls within the DockContentWidget. This heavily reduces the number of layout and geometry calculation events fired to the compositor (max 1 per 150ms) when rapidly scanning and appending Wi-Fi hotspots, thereby fixing visual flickering issues in Wayland without leaving dead space.
性能:优化任务栏网络插件面板高度调整频率
在 DockContentWidget 内部引入了 QTimer 对 updateSize 调用进行节流 (防抖)处理。扫描并连续追加 Wi-Fi 热点时,大幅减少发往合成器的
布局与几何计算事件(受限于最多 150ms 一次),从而修复了 Wayland 下
因窗口频繁变尺寸而引发的闪烁问题,同时也完整保留了正常的自适应包
裹尺寸机制。
Log: optimize dock network plugin panel height resizing frequency
Summary by Sourcery
Enhancements: