Bug 413019 - Widget positioning is broken when switching to the external monitor
Summary: Widget positioning is broken when switching to the external monitor
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop Containment (show other bugs)
Version: 5.17.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Sebastian Kügler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-16 07:12 UTC by Oleg Kapitonov
Modified: 2019-10-23 14:45 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.17.2


Attachments
Screenshot before switching to the external monitor (1.38 MB, image/png)
2019-10-18 10:36 UTC, Oleg Kapitonov
Details
Screenshot after switchng to the external mpnitor (1.69 MB, image/png)
2019-10-18 10:36 UTC, Oleg Kapitonov
Details
Widget positions before logging out. (178.44 KB, image/jpeg)
2019-10-20 12:33 UTC, cassie_lx
Details
Widget positions after logging out and in (179.44 KB, image/jpeg)
2019-10-20 12:34 UTC, cassie_lx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Kapitonov 2019-10-16 07:12:23 UTC
SUMMARY

Widget position on the desktop and it's size is completely broken when switching to the external monitor.

STEPS TO REPRODUCE
1. Place any widget on the desktop.
2. Switch to the external monitor.

OBSERVED RESULT

Widget size and position change dramatically.

EXPECTED RESULT

Widget size and position remain the same.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma:  Arch/Plasma 5.17
(available in About System)
Comment 1 Oleg Kapitonov 2019-10-16 12:06:55 UTC
The same problem occurs when the resolution is changed. Size and position of widgets change in very strange way.
Comment 2 Oleg Kapitonov 2019-10-16 13:21:55 UTC
Widgets return to normal view after plasmashell restart

$kquitapp5 plasmashell && kstart plasmashell
Comment 3 Oleg Kapitonov 2019-10-17 14:42:22 UTC
The same problem exists in KDE Neon 5.17, fresh installed.
Comment 4 Marco Martin 2019-10-17 21:22:38 UTC
I need a screenshot before and after and the resolutions of the internal and external monitors
Comment 5 Kai Uwe Broulik 2019-10-18 09:49:44 UTC
I can confirm on my laptop where SDDM has a different resolution from the desktop. I log in, you can see KSplash shifting as the resolutions change and in the end my widgets are all stuck to the left side of the screen in a square.

I suspect the fact that resolutions change during plasmashell startup has it remember the old resolution and then try to apply its heuristic of keeping screen distance same, which might also break when the aspect ratio change.

I wonder if merely putting a m_containment->corona()->isStartupCompleted() check before remembering geometryBeforeResolution already mitigates this.
Comment 6 Oleg Kapitonov 2019-10-18 10:36:09 UTC
Created attachment 123312 [details]
Screenshot before switching to the external monitor
Comment 7 Oleg Kapitonov 2019-10-18 10:36:52 UTC
Created attachment 123314 [details]
Screenshot after switchng to the external mpnitor
Comment 8 Oleg Kapitonov 2019-10-18 10:38:13 UTC
My laptop screen resolution is 1366x768

External monitor resolution is 1280x1024
Comment 9 cassie_lx 2019-10-20 12:30:35 UTC
I'm using KDEneon 5.17.0 with a two monitor setup (1920x1080 and 1280x1024).
After the update to Plasma 5.17.0 the widgets begun to resize and move to new positions on my 1280x1024 screen (I only have widgets on this screen). This happens after logging in nearly every time.

So I can confirm this bug.

(See my screenshots)

Question and suggestion:
Is it really needed to move the widgets around? I can do this by hand and sometimes it is intended to overlap two widgets. The only case to move a widget by the system is if it floats out of the viewable area. This automatic rezise and move around thing should stripped out of the code in my opinion. Only a suggestion. This is a very wired behavior.
Comment 10 cassie_lx 2019-10-20 12:33:45 UTC
Created attachment 123358 [details]
Widget positions before logging out.
Comment 11 cassie_lx 2019-10-20 12:34:36 UTC
Created attachment 123359 [details]
Widget positions after logging out and in
Comment 12 Marco Martin 2019-10-23 08:45:07 UTC
Git commit 0e25e9ad108d074f01b3a70a77e1fb7899b05058 by Marco Martin.
Committed on 23/10/2019 at 08:41.
Pushed by mart into branch 'Plasma/5.17'.

clear the cells before relayouting the items

when items are moved around due to screen resolution change,
no cell should be considered as taken, because all items will be moved,
otherwise items will be moved and resized in unexpected ways to make
room for "ghost" items.
Clear the bookkeeping before doing the move

M  +2    -0    components/containmentlayoutmanager/gridlayoutmanager.cpp

https://commits.kde.org/plasma-workspace/0e25e9ad108d074f01b3a70a77e1fb7899b05058
Comment 13 Marco Martin 2019-10-23 08:47:30 UTC
this commit restores the intended behavior:
when the screen resolution changes, widgets will be moved as little as possible (space from screen edges tries to be kept).
IF they won't be touched by the user, when getting back to the previous resolution, they will be restored exactly as they were before changing resolution