Commit 049b702
committed
fix(shot): suppress XRecord relay on normal path to fix selection flicker 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:
- mouseMoveEF records m_lastNativeMouseMoveMs on every native MouseMove
(relayed events are gated by m_isRelayedEvent flag to avoid polluting)
- onMouseDrag/onMouseMove only relay when no native event arrived in >50ms
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 补发仍正常工作1 parent 42627c1 commit 049b702
2 files changed
Lines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
| 632 | + | |
632 | 633 | | |
633 | 634 | | |
| 635 | + | |
634 | 636 | | |
635 | 637 | | |
636 | 638 | | |
| |||
5297 | 5299 | | |
5298 | 5300 | | |
5299 | 5301 | | |
| 5302 | + | |
| 5303 | + | |
| 5304 | + | |
| 5305 | + | |
5300 | 5306 | | |
5301 | 5307 | | |
5302 | 5308 | | |
| |||
6037 | 6043 | | |
6038 | 6044 | | |
6039 | 6045 | | |
6040 | | - | |
6041 | | - | |
6042 | | - | |
| 6046 | + | |
| 6047 | + | |
| 6048 | + | |
6043 | 6049 | | |
6044 | | - | |
6045 | | - | |
6046 | | - | |
| 6050 | + | |
| 6051 | + | |
6047 | 6052 | | |
6048 | 6053 | | |
6049 | 6054 | | |
| |||
6103 | 6108 | | |
6104 | 6109 | | |
6105 | 6110 | | |
6106 | | - | |
6107 | | - | |
| 6111 | + | |
6108 | 6112 | | |
6109 | 6113 | | |
6110 | | - | |
6111 | | - | |
| 6114 | + | |
6112 | 6115 | | |
6113 | 6116 | | |
6114 | | - | |
6115 | | - | |
6116 | | - | |
| 6117 | + | |
| 6118 | + | |
6117 | 6119 | | |
6118 | 6120 | | |
6119 | 6121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1438 | 1438 | | |
1439 | 1439 | | |
1440 | 1440 | | |
1441 | | - | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
1442 | 1444 | | |
1443 | 1445 | | |
1444 | 1446 | | |
| |||
0 commit comments