Commit 3bd2a1f
committed
fix: fix lock screen window positioning on multi-monitor X11 setups
On X11 multi-monitor setups (especially with mixed resolutions like 4K + 1080p),
lock screen windows could end up incorrectly positioned, with both windows
appearing on the primary monitor. This was caused by:
1. QWindow not being associated with the correct QScreen on X11, causing Qt's
internal coordinate transformation to use wrong screen parameters.
2. Qt's setGeometry() caching optimization silently skipping the actual XCB
configure request when it believed the geometry was already correct, even
though the X window had not actually been moved.
Changes:
- Call windowHandle()->setScreen(m_screen) on X11 (previously only on Wayland)
to ensure correct screen association before setting geometry.
- Add XCB-level geometry verification in the reset timer callback to detect
when Qt's cached geometry doesn't match the actual X window position.
- When XCB mismatch is detected, force re-apply geometry by resetting to (0,0,0,0)
first to bypass Qt's "geometry unchanged" optimization.
- Add detailed diagnostic logging for screen initialization and geometry tracking.
X11多屏环境下(尤其是混合分辨率如4K+1080p),锁屏窗口可能定位错误,
两个窗口都显示在主屏上。原因是:
1. X11下QWindow未正确关联到目标QScreen,导致Qt内部坐标转换使用了
错误的屏幕参数。
2. Qt的setGeometry()缓存优化会在它认为geometry已正确时跳过实际的
XCB configure请求,即使X窗口实际并未移动。
修改内容:
- 在X11下也调用windowHandle()->setScreen(m_screen)(之前仅Wayland下调用),
确保设置geometry前屏幕关联正确。
- 在定时器回调中增加XCB级别的geometry验证,检测Qt缓存geometry与X窗口
实际位置不一致的情况。
- 当检测到XCB位置不匹配时,先setGeometry(0,0,0,0)再设目标值,破坏Qt的
"geometry未变"优化,强制重新下发XCB configure请求。
- 增加屏幕初始化和geometry追踪的详细诊断日志。
Log: fix lock screen window positioning on multi-monitor X11 setups
Pms: BUG-3261631 parent a711d9f commit 3bd2a1f
2 files changed
Lines changed: 123 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
| |||
244 | 256 | | |
245 | 257 | | |
246 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
247 | 270 | | |
248 | 271 | | |
249 | | - | |
250 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
251 | 306 | | |
252 | 307 | | |
253 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
| 85 | + | |
78 | 86 | | |
79 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
80 | 131 | | |
81 | 132 | | |
82 | 133 | | |
| |||
453 | 504 | | |
454 | 505 | | |
455 | 506 | | |
456 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
457 | 511 | | |
| 512 | + | |
458 | 513 | | |
459 | 514 | | |
460 | 515 | | |
| 516 | + | |
461 | 517 | | |
462 | 518 | | |
463 | | - | |
| 519 | + | |
| 520 | + | |
464 | 521 | | |
465 | 522 | | |
466 | 523 | | |
| |||
735 | 792 | | |
736 | 793 | | |
737 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
738 | 801 | | |
739 | 802 | | |
740 | 803 | | |
| |||
0 commit comments