I have a MacBook Pro with an additional monitor attached. I've set up an automatic desktop lock when the laptop lid is closed. When I close the lid the lock screen appears on the right side of the external monitor, covering slightly less than a half of the screen width; the other half is black. When I open the lid the lock screen appears on the laptop screen. On the external the part of the lock screen moves to the left half - the one that was previously black. The right half shows the desktop, as it was before locking. Additionally, the lock screen seems very sluggish (even the mouse cursor moves jagged) and the password field loses focus sometimes, when I enter the password (which results in failed logins). After the log in, all windows that were open on the external screen before locking are moved to the laptop screen instead. This is a security issue as it is easy to view contents of the locked desktop without logging in. Reproducible: Always Steps to Reproduce: 1. Have a laptop with an external monitor. I have MacBook Pro 2010 with a 27' Apple Cinema Display. The external display should be configured as an extension of the desktop (i.e. not clone) - in my case, right of the laptop screen. The external screen is the main screen. 2. Set up desktop locking on closing the lid: 2.1. Go to System Settings -> Power Management -> Energy Saving tab. 2.2. For all power saving plans, set "Button events handling" to enabled, "When laptop lid closed" to "Lock screen" and "Even when an external monitor is connected" to enabled. 3. Close the laptop lid. Watch the screen contents. 4. Open the laptop lid. Watch the screen contents. 5. Try to enter the password. To witness the focus loss it may be needed to enter the password soon after the lid is open. Actual Results: 1. When the lid is closed the lock screen covers only part of the external screen, slightly less than a half. The password field is off-screen (i.e. not visible). The other part of the screen is black. 2. When the lid is open the lock screen covers the other part of the external screen, which was previously black. The other part shows the desktop. 3. The lock screen is sluggish, the password field sometimes loses focus when entering the password. 4. After login all windows that were previously on the external screen are moved to the laptop screen. Expected Results: 1. Under no circumstances the desktop contents should be displayed when the desktop is locked. This part of the issue is the most critical for me. 2. The lock screen should cover the whole screen, not half of it. At least the password field should be visible. 3. There should be no focus loss when typing in the password. This is another potential security issue as the password can be logged. 4. Locking and unlocking by closing the lid should not affect windows placement. Kubuntu 15.04, x86_64, KDE Frameworks 5.9, Plasma 5.3 installed from Kubuntu backports. I have opensource radeon driver installed.
please have a look at the output of xrandr when the problem happens. From experience with other bug reports I'm quite certain that the information reported by xrandr is wrong which would explain the problems you see. If that's the case there is not much we can do about it: if the system "lies" to us about the screen geometries...
Where can I find XRandr logs? Neither /var/log/Xorg.0.log nor ~/.xsession-errors have XRandr messages when the lid is closed or opened. I'll attach these logs anyway, in case there's anything interesting in there.
Created attachment 92697 [details] .xsession-errors logs when closing and opening the lid
Created attachment 92698 [details] Xorg log
I'll add that the lock screen worked correctly in Kubuntu 14.10 (with KDE 4) on the same machine. Also, it seems not all windows are moved to the laptop screen after the lid is open. I had a linphone window which was not moved. On the other hand, the windows that were moved were maximized before I locked the desktop, so maybe that is the essential factor.
Please keep it to the actual problem and ignore the window placement here. That just clutters up the report. you need to actually run xrandr command while the system is in the strange state. For that best go to a tty. log in and run: DISPLAY=:0 xrandr
Created attachment 92701 [details] xrandr output when the lid is closed
Created attachment 92702 [details] xrandr output when the lid is opened
I've attached xrandr output. > Please keep it to the actual problem and ignore the window placement here. Do you mean that windows placement is a separate bug (i.e. must be reported separately)? Against what component?
and we can see the problem there. It's as I expected/feared. In the one we have: LVDS connected 1440x900+0+0 In the other, it's just: LVDS connected Which means it's no longer considered as an output, it doesn't have a resolution. But the overall geometry of the combined screens is in both cases: current 4000 x 1440 while in the one case it should only be 2560x1440 I assume that running xrandr --auto while the problem is visible will fix it. Sorry it's a problem we have seen relatively often lately that the information in xrandr is just wrong. Unfortunately it's out of our responsibility, we rely on the data being correct :-(
Unfortunately, xrandr --auto does not help. When executing with lid closed it prints "Configure crtc 1 failed", with lid open it doesn't print anything but in both cases the lock screen is not fixed. Interestingly, during my experiments I had one time when on closing the lid the lock screen covered the whole external screen. I verified the xrandr output in this case, it was the same as the one I attached before, with lid closed. I.e. it also had "current 4000 x 1440" and "LVDS connected" with no resolution. I can't test Kubuntu 14.10 now, so I don't know if xrandr output was different then, but the instability in behavior I described above hints that at least sometimes xrandr output is "good enough".
The warning is interesting. It could explain why xrandr gets into the incorrect state: e.g. it also failed when closing the lid, thus being in incorrect state. I'm just wondering whether there is something we can do to improve the situation. We probably cannot get the lock screen to display correctly under these conditions. But we could make the blanking better.
I remember that we have improvements in KScreen which might be related to the problem. Once Plasma 5.4 is released: could you please test whether the issue is still valid and in case it is, please reopen. Thank you!
I upgraded to Kubuntu 15.10, which ships with KDE 5.4. The problem reproduces almost exactly the same. When closing the lid the lock screen covers about the half of the screen, the other half is black. When opening the lid the lock screen moves to the other half, and the half it was covering before is black. After opening the lid the interface is sluggish, and after logging in all maximized windows are moved to the laptop screen instead of preserving their original positions. I've only tried a couple of times and didn't observe the issue of the desktop being shown beside the lock screen. I cannot be sure that this aspect of the problem has been fixed though, as it did not reproduce 100% of the time before. I also didn't notice focus loss from the password entering field. I'll add one thing that I didn't mention before. When the lock screen is covering only half of the screen, I can move the mouse across the whole screen, including the black part. I.e. the mouse pointer is correctly limited by the actual screen boundaries, not the lock screen boundaries. To uneducated me this looks like at least some portion of KDE/X.org is recognizing the screen configuration correctly while the lock screen does not.
Also, I'd like to add that when using XFCE with GNOME screen locker on the machine (on the same Kubuntu) and it doesn't have such problems. The lock screen always cover the whole screen when the lid is closed.
I know it will sound lame: there are some improvements in Plasma 5.5. If you have a chance to give it a try there, it would be appreciated. That would also allow us to do another round of investigation based on the latest code.
Ping! Can you see if this still reproduces? FWIW I've never seen it with any version of Kubuntu later than 16.04.
Sorry, I no longer have the laptop that showed the problem, so I can't test it.
Can you reproduce the issue using your current machine?
I tried with another laptop (Asus N550JV, Intel GPU, the other screen is a Samsung TV connected over HDMI). Kubuntu 17.10, kscreen 5.10.5. When I close the lid, the other screen blinks a few times (some portions of the screen turn black and back the lock screen) but eventually the lock screen is displayed as expected, covering the whole screen, the focus is on the password field. When I open the lid back, the lid screen is black, but I can move the mouse over it. In a few tests I've done it never showed the lock screen. On the other screen the lock screen is still displayed but loses focus, so I have to manually click on the password field to login. I think the two problems (the lid screen not showing the lock screen and the focus loss) still need fixing.
Thanks a lot for checking!
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreenlocker/-/merge_requests/23
Just merged the fix in https://invent.kde.org/plasma/kscreenlocker/-/merge_requests/23 - before this fix I could trigger the issue by adding/removing monitors (this can also occur on resume/wakeup with external monitor attached). Would be very interested to know if anyone could confirm the change fixed the issue for them. Commit: https://invent.kde.org/plasma/kscreenlocker/-/commit/6f2ef9235c39b068e2cc4df77d660f4db8dfd451