Repository navigation
fix(linux): keep KWin output order stable - #6183
ReenigneArcher merged 1 commit into
Conversation
I can see the logical issue with the existing code here and using Haven't had time to test this on my setup but from a purely theoretical/cppreference standpoint it's LGTM. |
ReenigneArcher
left a comment
There was a problem hiding this comment.
The tuple comparison correctly fixes the invalid ordering still present on the current target branch. Requesting changes for the missing regression coverage described inline.
Local verification: the exact comparator and output type extracted from the PR pass a C++23 harness with AddressSanitizer/UndefinedBehaviorSanitizer, including all six permutations of the reported three-monitor layout and priority/X/Y/equality checks. The target comparator fails the asymmetry check. The diff whitespace check and clang-format check on changed lines pass.
Verification limits: Sunshine's Linux tests and a live KWin session were not run on this macOS host. SonarCloud and Read the Docs report success; CI, CodeQL, and common lint await maintainer workflow approval, so their results are unavailable. GitHub currently reports no merge conflicts.
Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh
The sort checked priority OR x OR y, so any one comparison could win and two monitors could both count as first. If the primary monitor wasn't at x=0, the list came back in a different order each time and Ctrl+Alt+Shift+F1/F2 swapped screens. Now it sorts by priority, then x, then y.
f4067e8 to
d664483
Compare
|
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6183 +/- ##
==========================================
- Coverage 52.52% 52.49% -0.03%
==========================================
Files 149 149
Lines 33003 33002 -1
Branches 13890 13889 -1
==========================================
- Hits 17334 17326 -8
+ Misses 14329 13573 -756
- Partials 1340 2103 +763
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 30 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
Screenshot ComparisonPR #6183 screenshots vs Matrix:
|
















































































Description
With KWin capture, the monitor list order changed every session if the primary monitor wasn't the leftmost one. The sort checked priority OR x OR y, so any comparison could win and two monitors could both be "first". On my setup (primary in the middle, a monitor at x=0 on the left) Ctrl+Alt+Shift+F1 and F2 kept swapping screens while F3 was always right.
The fix sorts by priority first, then x, then y. With 3 monitors on Plasma 6, F1/F2/F3 now always land on the same screen.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Testing
No automated test. The sort lives inside the KWin screencast class and needs a live KWin session, and there are no kwingrab unit tests to extend. Tested by hand on CachyOS with Plasma 6, an RTX 3080 and an AMD iGPU, with 3 monitors (primary DP-2 at x=1920, HDMI-A-3 at x=0, DP-4 at x=4480). Before the fix the "[kwingrab] Found output" log order flipped between DP-2 and HDMI-A-3 across sessions and F1/F2 swapped screens. After it the order stays DP-2, HDMI-A-3, DP-4 and F1/F2/F3 always pick the same screen.
Type of Change
Checklist
AI Usage
See our AI usage policy.