Bug 470434 - Plasma Panel Switches Monitor After Screen Wakes
Summary: Plasma Panel Switches Monitor After Screen Wakes
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop Containment (show other bugs)
Version: 5.27.2
Platform: Debian unstable Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: multiscreen
Depends on:
Blocks:
 
Reported: 2023-05-29 23:29 UTC by email@thelinuxcast.org
Modified: 2024-03-26 14:12 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description email@thelinuxcast.org 2023-05-29 23:29:11 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Let monitors go to sleep (Dual monitor setup)
2. Wake Monitors
3. Panel has switched monitors

OBSERVED RESULT
Panel switching from primary monitor to secondary monitor

EXPECTED RESULT
Panels stay where they were originally placed

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Debian Bookworm RC4  - KDE Plasma 5.27.2
(available in About System)
KDE Plasma Version:  5.27.2
KDE Frameworks Version:  5.103
Qt Version: 5.15.8

ADDITIONAL INFORMATION

Unsure if this is related to kscreen or not. Disabling kscreen does not seem to fix the problem, but I didn't know where else to put it. Apologies if it's in the wrong place. May have been better to put his in kwin, but again unsure. 

Oddly the Display manager does not change the primary designation of the monitors,  that stays the way it should be. In order to fix the problem, I have to switch the primary designation to the wrong monitor and the back to the correct monitor to get the panel to revert to its proper place.
Comment 1 Nate Graham 2024-03-14 16:35:09 UTC
Thanks for the bug report. A few questions:

1. Does it happen only on X11, only on Wayland, or on both?
2. Does it also happen if you lock the screen with Meta+L and then unlock, or only on screen sleep/wake?
Comment 2 Nate Graham 2024-03-14 16:37:19 UTC
Oh and one more question as well:

3. If you create a new clean user account and replicate by hand the same panel setup there, does the bug still happen? Or not?
Comment 3 Nate Graham 2024-03-14 16:46:52 UTC
Forgot two more:

4. What GPU are these screens plugged into?
5. When this happens, can you make the issue go away by restarting plasmashell with `systemctl restart --user plasma-plasmashell.service` (assuming you're using the systemd boot; if not, try `plasmashell --replace`)?
Comment 4 Bug Janitor Service 2024-03-19 09:30:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4108
Comment 5 David Redondo 2024-03-26 13:59:36 UTC
Git commit 27dd68970f33627ba52903c2fc5b1442c7217e0f by David Redondo.
Committed on 26/03/2024 at 13:47.
Pushed by davidre into branch 'master'.

Avoid positioning the panel when it has no size yet

Calling setPosition with a position of the left-most pixel of a screen
and  size of 0x0 will set the screen to be the one to the left of it.
Making screenToFollow() and QWindow::screen() out of sync temporarily.
While arguably a Qt issue and this being fixed up later when the panel
resizes and other properties are updated, we need to workaround this
to our usage of layer-shell. Layer surfaces can't change screen once
created. It can happen that the surface is created during the time
that the panel is on the wrong screen, resulting in the panel
appearing on the wrong screen while thinking it is on another one.
To fix this the initial positionPanel() call is removed, the
panel will now be positioned after it has resized from the event handler.
Related: bug 483102, bug 483348
FIXED-IN:6.0.3

M  +1    -1    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/27dd68970f33627ba52903c2fc5b1442c7217e0f
Comment 6 David Redondo 2024-03-26 14:12:29 UTC
Git commit d03a98fc69c94f83f9410651d15a21ff41a72904 by David Redondo.
Committed on 26/03/2024 at 14:06.
Pushed by davidre into branch 'Plasma/6.0'.

Avoid positioning the panel when it has no size yet

Calling setPosition with a position of the left-most pixel of a screen
and  size of 0x0 will set the screen to be the one to the left of it.
Making screenToFollow() and QWindow::screen() out of sync temporarily.
While arguably a Qt issue and this being fixed up later when the panel
resizes and other properties are updated, we need to workaround this
to our usage of layer-shell. Layer surfaces can't change screen once
created. It can happen that the surface is created during the time
that the panel is on the wrong screen, resulting in the panel
appearing on the wrong screen while thinking it is on another one.
To fix this the initial positionPanel() call is removed, the
panel will now be positioned after it has resized from the event handler.
Related: bug 483102, bug 483348
FIXED-IN:6.0.3


(cherry picked from commit 27dd68970f33627ba52903c2fc5b1442c7217e0f)

M  +1    -1    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/d03a98fc69c94f83f9410651d15a21ff41a72904