fix(shot): suppress XRecord relay on normal path to fix selection fli…#852
fix(shot): suppress XRecord relay on normal path to fix selection fli…#852dengzhongyuan365-dev wants to merge 0 commit into
Conversation
049b702 to
e8b31f9
Compare
deepin pr auto review你好!我是CodeGeeX。我已经仔细审查了你提供的Git Diff。这次代码变更的核心目的是优化XRecord与Qt原生事件通路的冲突,将原本基于“坐标去重”的补发逻辑,优化为基于“时间阈值(Staleness)”的补发逻辑,以解决Dock Grab阻断原生事件时的问题,并避免正常情况下的双重触发。 整体来看,这个思路非常清晰且有效,但在语法逻辑、代码质量、性能和安全性方面,我有一些改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码建议1. 头文件
|
e8b31f9 to
42627c1
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev, lzwind 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 |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev, lzwind 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 |
…cker on HiDPI
The XRecord relay introduced in BUG-330895 uses coordinate comparison (m_currentCursor vs rootX/rootY) to deduplicate events when Qt already handled them via the native path. However on HiDPI screens the two coordinates live in different spaces — mouseEvent->pos() is a widget-local logical coordinate scaled by pixelRatio, while rootX/rootY are physical screen pixels — so the comparison always evaluates to unequal. Every mouse move during drag triggers two repaint() calls (one from Qt native, one from XRecord relay), causing the dashed selection border to flicker.
Replace the coordinate-based dedup with a timestamp approach:
At ~60fps, native events land every ~16ms, so the 50ms threshold completely suppresses relay under normal operation. When a Dock Grab blocks Qt input, the gap exceeds 50ms and relay kicks in automatically.
Log: 修复高分屏截图框选虚线闪烁问题
PMS: BUG-330895
Influence: 高分屏拖拽框选不再闪烁;Dock Grab 场景下 XRecord 补发仍正常工作