Bug 484484 - Screenss are mirrored after waking up from sleep with lid closed
Summary: Screenss are mirrored after waking up from sleep with lid closed
Status: REPORTED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-25 21:38 UTC by Natalie Clarius
Modified: 2024-07-23 21:10 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 Natalie Clarius 2024-03-25 21:38:48 UTC
STEPS TO REPRODUCE
1. Laptop with internal screen and external screen (VGA) set up to the right of the laptop screen
2. Close the laptop lid while configured to go to sleep
3. Open the lid again to wake the laptop up again

OBSERVED RESULT
Screens are mirrored, not shown as "replica of" but overlapped

EXPECTED RESULT
Screens are aligned next to each other, as before

SOFTWARE/OS VERSIONS
git master
X11

ADDITIONAL INFORMATION
It does not happen when sending the laptop to sleep e.g. through the KRunner action.
Comment 1 Natalie Clarius 2024-03-26 00:00:34 UTC
Further info:
- not reproducible every time
- didn't occur on Wayland the one time I tested it
- connection is VGA on the monitor side and USB-C on the laptop side with an adapter
Comment 2 Natalie Clarius 2024-07-23 20:37:18 UTC
It's https://invent.kde.org/plasma/kscreen/-/blob/master/kded/daemon.cpp?ref_type=heads#L542 that does that and I don't understand why that line is there.

From the journal:
> Jul 23 15:13:18 montague kded6[531910]: kscreen.kded: KScreen::Output(65, "eDP-1", connected enabled priority 1, pos: QPoint(0,0),>
> Jul 23 15:13:18 montague kded6[531910]: kscreen.kded: KScreen::Output(68, "DP-2", connected enabled priority 2, pos: QPoint(1920,0>
> Jul 23 19:06:33 montague kded6[531910]: kscreen.kded: Lid closed, waiting to see if the computer goes to sleep...
> Jul 23 19:13:36 montague kded6[531910]: kscreen.kded: Moving "DP-2" from QPoint(1920,0) to QPoint(0,0)
> Jul 23 19:13:36 montague kded6[531910]: kscreen.kded: Lid opened!

That second to last entry is what shouldn't happen, or what should be reverted after opening the lid.
Comment 3 Natalie Clarius 2024-07-23 20:41:46 UTC
Looks like it should be moved when the lid is closed when the laptop output is disabled (which is reasonable I guess) but judging by the timestamps this doesn't actually happen until after the lid is already opened again and it never gets properly reverted?
Comment 4 Natalie Clarius 2024-07-23 21:01:12 UTC
One more relevant entry:

> Jul 23 22:20:06 montague kded6[531910]: kscreen.kded: Lid closed, finding lid to disable
> Jul 23 19:31:03 montague kded6[531910]: kscreen.kded: Lid closed, waiting to see if the computer goes to sleep...
> Jul 23 19:13:36 montague kded6[531910]: kscreen.kded: Moving "DP-2" from QPoint(1920,0) to QPoint(0,0)
> Jul 23 19:13:36 montague kded6[531910]: kscreen.kded: Lid opened!

So it looks like the check in https://invent.kde.org/plasma/kscreen/-/blob/master/kded/daemon.cpp?ref_type=heads#L452 fails to fire.
Comment 5 Natalie Clarius 2024-07-23 21:10:13 UTC
I got messages with timestamps from different iterations mixed up but the order is right. The last three messages all get printed at the same second, when the lid is already open again, but the disableLidOutput still seems to kick just before the lidClosedChanged does.