Skip to content

Commit ed9fd77

Browse files
committed
fix(tray): pre-create stashed popup to eliminate first-open lag
Pre-create the stashed tray popup during initialization to avoid lag when first opening it, especially noticeable at high DPI scales (225%). The popup is opened with zero opacity during startup and closed after 200ms, ensuring all components are fully initialized. This eliminates the frame drops and stuttering that occurred when hovering over or clicking the application tray button for the first time. 修复系统托盘折叠弹窗首次打开时的卡顿问题。在初始化时预创建弹窗, 通过设置透明度为0在后台完成组件初始化和渲染,避免首次打开时的 帧率下降和卡顿,特别是在高DPI缩放(225%)下的表现。 PMS: BUG-344705
1 parent 1127204 commit ed9fd77

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

panels/dock/tray/package/tray.qml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ AppletItem {
4343

4444
property alias dropHover: stashContainer.dropHover
4545
property alias stashItemDragging: stashContainer.stashItemDragging
46+
property bool preCreating: false
47+
48+
opacity: preCreating ? 0 : 1
4649

4750
popupX: DockPanelPositioner.x
4851
popupY: DockPanelPositioner.y
@@ -79,8 +82,25 @@ AppletItem {
7982
DockPanelPositioner.bounding = Qt.binding(function () {
8083
return Qt.rect(collapsedBtnCenterPoint.x, collapsedBtnCenterPoint.y, stashedPopup.width, stashedPopup.height)
8184
})
85+
// Pre-create popup to avoid first-open lag
86+
Qt.callLater(function() {
87+
stashedPopup.preCreating = false
88+
stashedPopup.open()
89+
preCreateCloseTimer.start()
90+
})
8291
}
8392
}
93+
94+
Timer {
95+
id: preCreateCloseTimer
96+
interval: 200
97+
repeat: false
98+
onTriggered: {
99+
stashedPopup.close()
100+
stashedPopup.preCreating = false
101+
}
102+
}
103+
84104
Connections {
85105
target: DDT.TraySortOrderModel
86106
function onActionsAlwaysVisibleChanged(val) {

0 commit comments

Comments
 (0)