fix: resolve flickering and position shift when switching panel popups#1576
fix: resolve flickering and position shift when switching panel popups#1576deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
There was a problem hiding this comment.
Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, mhduiy 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 |
|
TAG Bot New tag: 2.0.39 |
Refactor the open/close mechanism for PanelPopup, PanelMenu, and PanelToolTip to eliminate visual flickering and incorrect positioning that occurred when rapidly switching between popups. The previous implementation used a timer-based delayed opening approach, which could cause the old popup to close and the new one to appear at an intermediate frame with incorrect geometry. Changes: 1. Replaced Timer-based delayed opening with a geometry update callback mechanism 2. Added `openPending` property to track pending operations 3. Added `finalizeOpen()` function to complete opening after geometry update 4. Added `onUpdateGeometryFinished` signal handling to coordinate opening with geometry updates 5. Removed `delayed: true` from x/y Binding properties for immediate position updates 6. Added proper handling for reopening when popup is already visible 7. Added `geometryUpdatePending` guard in PanelPopupWindow to prevent duplicate updates 8. Added default initialization values for `m_dragging` and `m_pressing` in popupwindow.h 9. Fixed trailing newline issue in PanelPopupWindow.qml Log: Fixed popup flickering and position issues when switching panels Influence: 1. Test rapid switching between multiple popups/menus/tooltips 2. Verify popup open/close animations are smooth without flickering 3. Test popup positioning accuracy when opened from different screen locations 4. Verify that popups close properly when clicking outside or switching focus 5. Test the "reopen" scenario: close a popup and immediately open the same or a different one 6. Verify that the X11 grab focus transition works correctly after this change 7. Test on both X11 and Wayland sessions if applicable fix: 解决面板弹窗切换时的闪烁和位置偏移问题 重构PanelPopup、PanelMenu和PanelToolTip的打开/关闭机制,消除快速切换弹窗 时出现的视觉闪烁和位置错误。之前的实现使用基于定时器的延迟打开方式,可能 导致旧弹窗关闭后新弹窗在中间帧显示错误的几何位置。 变更内容: 1. 将基于Timer的延迟打开替换为几何更新回调机制 2. 添加`openPending`属性跟踪待处理操作 3. 添加`finalizeOpen()`函数在几何更新完成后完成打开操作 4. 添加`onUpdateGeometryFinished`信号处理,协调打开与几何更新 5. 从x/y绑定属性中移除`delayed: true`,实现即时位置更新 6. 添加弹窗已可见时重新打开的正确处理 7. 在PanelPopupWindow中添加`geometryUpdatePending`防护,防止重复更新 8. 在popupwindow.h中为`m_dragging`和`m_pressing`添加默认初始化值 9. 修复PanelPopupWindow.qml中缺失的换行符 Log: 修复面板切换时弹窗闪烁和位置问题 Influence: 1. 测试多个弹窗/菜单/提示框之间的快速切换 2. 验证弹窗打开/关闭动画是否流畅无闪烁 3. 测试从不同屏幕位置打开时弹窗定位的准确性 4. 验证点击外部区域或切换焦点时弹窗是否正确关闭 5. 测试"重新打开"场景:关闭弹窗后立即打开相同或不同的弹窗 6. 验证此更改后X11抓取焦点过渡功能是否正常工作 7. 如适用,在X11和Wayland会话上测试
deepin pr auto review这份代码修改主要涉及了 Qt/QML 中的窗口管理逻辑,特别是针对 1. 语法逻辑优点:
潜在问题:
2. 代码质量优点:
改进建议:
3. 代码性能优点:
改进建议:
4. 代码安全优点:
潜在问题:
5. 具体改进建议5.1 提取共享逻辑可以将 // BasePopup.qml
QtObject {
id: control
property bool openPending: false
property bool readyBinding: false
property Item window
function finalizeOpen() {
if (!window || !openPending || !readyBinding || window.currentItem !== control)
return
openPending = false
window.title = windowTitle
window.show()
}
}然后在 5.2 增加注释在关键逻辑处增加注释,例如: // Indicates whether a window open request is pending.
property bool openPending: false5.3 优化绑定可以考虑使用 QtObject {
id: stateManager
property bool isReady: menuWindow && menuWindow.currentItem === control
}然后在 总结这份代码修改在语法逻辑、代码质量、性能和安全性方面都有所改进,但仍有一些可以优化的地方。主要的改进方向包括减少代码重复、优化绑定机制、增加注释和边界检查。通过这些改进,可以进一步提高代码的可维护性和健壮性。 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Refactor the open/close mechanism for PanelPopup, PanelMenu, and
PanelToolTip to eliminate visual flickering and incorrect positioning
that occurred when rapidly switching between popups. The previous
implementation used a timer-based delayed opening approach, which
could cause the old popup to close and the new one to appear at an
intermediate frame with incorrect geometry.
Changes:
mechanism
openPendingproperty to track pending operationsfinalizeOpen()function to complete opening after geometryupdate
onUpdateGeometryFinishedsignal handling to coordinateopening with geometry updates
delayed: truefrom x/y Binding properties for immediateposition updates
geometryUpdatePendingguard in PanelPopupWindow to preventduplicate updates
m_draggingandm_pressingin popupwindow.h
Log: Fixed popup flickering and position issues when switching panels
Influence:
locations
focus
same or a different one
change
fix: 解决面板弹窗切换时的闪烁和位置偏移问题
重构PanelPopup、PanelMenu和PanelToolTip的打开/关闭机制,消除快速切换弹窗
时出现的视觉闪烁和位置错误。之前的实现使用基于定时器的延迟打开方式,可能
导致旧弹窗关闭后新弹窗在中间帧显示错误的几何位置。
变更内容:
openPending属性跟踪待处理操作finalizeOpen()函数在几何更新完成后完成打开操作onUpdateGeometryFinished信号处理,协调打开与几何更新delayed: true,实现即时位置更新geometryUpdatePending防护,防止重复更新m_dragging和m_pressing添加默认初始化值Log: 修复面板切换时弹窗闪烁和位置问题
Influence: