Bug 454003 - [Wayland] Windows are moved on screen unlock
Summary: [Wayland] Windows are moved on screen unlock
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.24.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-18 17:05 UTC by RbHahn
Modified: 2024-06-07 20:15 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RbHahn 2022-05-18 17:05:13 UTC
In a 3-monitor setup (left to right: 1080x1920, 1920x1080, 1920x1080, middle screen is primary), all windows are moved to the leftmost screen when unlocking the screen. This only occurs when using the wayland session.


STEPS TO REPRODUCE
1. Choose wayland session when logging in
2. Lock screen or wait for session timeout
3. Unlock screen

OBSERVED RESULT
Windows lose their position and are all moved to the leftmost screen.

EXPECTED RESULT
Windows stay where they are.

SOFTWARE/OS VERSIONS
Arch Linux, Kernel 5.17.7
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4

ADDITIONAL INFORMATION
GPU: AMD RX6900XT, amdgpu driver
Using plasma-wayland-session
Comment 1 Nate Graham 2022-05-19 16:21:06 UTC
Did any of your screens turn off while the system was locked?

If so what probably happened was that KWin helpfully moved all the windows to the remaining screen that was on, but didn't notice when the other screens turned back on again, so it failed to move the windows back.
Comment 2 RbHahn 2022-05-29 17:45:04 UTC
(In reply to Nate Graham from comment #1)
> Did any of your screens turn off while the system was locked?
> 
> If so what probably happened was that KWin helpfully moved all the windows
> to the remaining screen that was on, but didn't notice when the other
> screens turned back on again, so it failed to move the windows back.

Yes, this issue always occurs when the screens are inactive long enough to turn off. However, it sometimes also occurs when the system is locked for a shorter period of time and the screens don't turn off. The expected behavior only occurs when the system is unlocked right after locking.
Comment 3 Bug Janitor Service 2022-06-23 16:13:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2573
Comment 4 Zamundaaa 2022-08-31 21:06:06 UTC
Git commit ba0799974ed7b30b973c6a6a40c35be4d30d2ca2 by Xaver Hugl.
Committed on 31/08/2022 at 20:30.
Pushed by zamundaaa into branch 'master'.

workspace: restore window position after output changes
Related: bug 455066, bug 374908, bug 444082, bug 453589

M  +1    -0    src/CMakeLists.txt
A  +197  -0    src/placementtracker.cpp     [License: GPL(v2.0+)]
A  +68   -0    src/placementtracker.h     [License: GPL(v2.0+)]
M  +6    -0    src/window.cpp
M  +3    -0    src/window.h
M  +29   -0    src/workspace.cpp
M  +3    -0    src/workspace.h

https://invent.kde.org/plasma/kwin/commit/ba0799974ed7b30b973c6a6a40c35be4d30d2ca2
Comment 5 dhummel 2024-03-21 16:48:05 UTC
This issue still appears to be occurring. I am on KDE Plasma Version 6.0.2 on Wayland with a single 4K monitor. Whenever the screen is locked and the display subsequently turns off, the windows have all been moved when unlocking the screen. This does not happen if the screen has not turned off while the screen was locked.

There is also an additional "unlock" button requiring being clicked during the unlocking process, shown right after entering a password.
Comment 6 Zamundaaa 2024-06-07 20:15:12 UTC
There were some regressions in the placement tracker that prevented it from working correctly in all cases, but they were fixed in 6.0.5.
If you still have this problem in 6.0.5, please make a new bug report with specific details about your setup (output layout, resolutions and scales) and the windows that were moved (and their positions before/after)