Bug 483348

Summary: Plasma desktop panel moving to wrong screen on next login
Product: [Plasma] plasmashell Reporter: adikso4
Component: PanelAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kmcwilliampublic, nate, niccolo.venerandi
Priority: NOR Keywords: multiscreen, qt6
Version: 6.0.3   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=480791
Latest Commit: Version Fixed In: 6.0.3
Sentry Crash Report:
Attachments: Incorrect placement of the panel
Incorrect alignment on X11
Not working on new account after opening panel edit
Rounded panel before opening edit
"Squared" panel after opening edit

Description adikso4 2024-03-12 15:04:44 UTC
Created attachment 167042 [details]
Incorrect placement of the panel

SUMMARY
Plasma desktop Panel is moving to the incorrect screen every time on next login and have to be moved manually. "Panels and Desktop Management" shows as if everything was okay, but only moving the panel (via "Panels and Desktop Management") to other screen and then moving it back to correct one shows it at the correct screen. 

STEPS TO REPRODUCE
1. Add a panel on top of the middle screen (3 monitors setup)
2. Re-login

OBSERVED RESULT
Panel is placed at an incorrect screen and "Panels and Desktop Management" doesn't know about this.

EXPECTED RESULT
Panel is placed at a correct screen

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Nate Graham 2024-03-14 16:40:07 UTC
Thanks for the bug report. A few questions:

1. Does it also happen on X11, or only on Wayland?
2. Does it also happen if you lock the screen with Meta+L and then unlock, or only on screen sleep/wake?
3. If you create a new clean user account and replicate by hand the same panel setup there, does the bug still happen? Or no?
4. What GPU are these screens plugged into?
Comment 2 Nate Graham 2024-03-14 16:45:25 UTC
Oh and one more too:

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 3 Nate Graham 2024-03-14 19:36:03 UTC
I'm asking all these questions because I strongly suspect this is Bug 483102, but I need a few more data points to be sure.
Comment 4 Bug Janitor Service 2024-03-19 09:30:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4108
Comment 5 adikso4 2024-03-19 10:24:27 UTC
Created attachment 167458 [details]
Incorrect alignment on X11
Comment 6 adikso4 2024-03-19 10:26:57 UTC
Created attachment 167460 [details]
Not working on new account after opening panel edit
Comment 7 adikso4 2024-03-19 10:29:11 UTC
Created attachment 167461 [details]
Rounded panel before opening edit
Comment 8 adikso4 2024-03-19 10:29:28 UTC
Created attachment 167462 [details]
"Squared" panel after opening edit
Comment 9 adikso4 2024-03-19 10:38:39 UTC
Sorry for delay, I was away from the affected system for a week.

(In reply to Nate Graham from comment #1)
> Thanks for the bug report. A few questions:
> 
> 1. Does it also happen on X11, or only on Wayland?
It doesn't show on another screen on X11, but the alignment is incorrect on X11. As visible on https://bugsfiles.kde.org/attachment.cgi?id=167458

> 2. Does it also happen if you lock the screen with Meta+L and then unlock, or only on screen sleep/wake?
That happens only on LOG-IN. Locking, unlocking, screen sleep doesn't change anything.

> 3. If you create a new clean user account and replicate by hand the same panel setup there, does the bug still happen? Or no?
It shows the panel on correct screen, but instantly when I will open panel editing, it will start to stick out to another screen (fill width). This is visible on https://bugsfiles.kde.org/attachment.cgi?id=167460

Also there is a difference in panel shape before and after going to edit. 
Before edit: https://bugs.kde.org/attachment.cgi?id=167461
After edit: https://bugs.kde.org/attachment.cgi?id=167462

I'm not editing anything, I'm just entering edit mode. 

> 4. What GPU are these screens plugged into?
This is AMD 6900 XT with "amdgpu" driver.

> 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`)?

For some reason it has problem with connecting to dbus, so I did `killall plasmashell` `kstart plasmashell`, and the effect is the same like on log-in - the panel is on the wrong screen.
Comment 10 David Redondo 2024-03-26 13:59:44 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 470434
FIXED-IN:6.0.3

M  +1    -1    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/27dd68970f33627ba52903c2fc5b1442c7217e0f
Comment 11 David Redondo 2024-03-26 14:12:37 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 470434
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
Comment 12 adikso4 2024-04-13 14:08:50 UTC
This bug is not fixed in 6.0.3. The problem still persists
Comment 13 adikso4 2024-07-26 16:05:57 UTC
I don't have this issue anymore