Bug 259183

Summary: Disabling or disconnecting secondary monitor causes desktop corruption, panels to disappear
Product: [Unmaintained] plasma4 Reporter: Synthetic451 <bugs.kde.org.facelift226>
Component: multiscreenAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: anselmolsm, aseigo, aspotashev, emisca, hsantanna, jan.kaspar, john.lloydjones, kaouete, kde, kdebugs, lundgren, magnus, maximlevitsky, menegola, meyerm, michael.alzheimer, parena, pmplay, remy.blank, wouter, zabbaskeema
Priority: NOR    
Version: 4.8.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.3
Sentry Crash Report:
Attachments: Screenshot of desktop corruption
plasma-desktop-appletsrc
plasma-desktoprc
wrong panel width
appletsrc for dual monitor
appletsrc for single monitor

Description Synthetic451 2010-12-08 01:55:45 UTC
Version:           unspecified (using KDE 4.5.4) 
OS:                Linux

I have an Nvidia Twinview setup with one 1680x1050 screen and another external 1440x900 screen. When I disable the external monitor by switching the resolution from 3120x1050 to 1680x1050, the desktop malfunctions. Parts of the desktop background will overlap windows and forcing a xrefresh will not remove them. Panels on the 1680x1050 screen disappear and clicking on the cashew/painter's pad icon in the top right corner pops up the menu for a millisecond before disappearing again.

Reproducible: Always

Steps to Reproduce:
1.) Have a Twinview setup
2.) Change KDE resolution to a resolution that shuts down one of the monitors.
3.) Notice the desktop corruption and disappearing panels
Comment 1 Synthetic451 2010-12-08 02:06:24 UTC
Created attachment 54279 [details]
Screenshot of desktop corruption

Here's a screenshot of the desktop corruption I am seeing. Note the bar in the top left corner. That is the top edge of the folder view widget and a part of my desktop background. I can not click on the buttons underneath the bar.
Comment 2 Synthetic451 2010-12-08 02:19:56 UTC
I did some more testing and the problem only occurs if you place an extra panel on the secondary monitor. The bar of corruption that shows is exactly the size of that panel. I have a feeling that Plasma thinks that the panel was "moved" to the primary monitor after the secondary monitor shut down and therefore it decided not to render the windows underneath the area where it thinks the panel is.
Comment 3 Aaron J. Seigo 2010-12-08 03:43:17 UTC
what is happening is that it is moving the panel view from the now-disconnected screen onto the still-there screen, but it isn't positioning the view onto the panel, but over the desktop containment. (comment #2 is therefore partly correct, but the conclusion is not; the windows are still rendered just fine under the panel).

what's odd is that neither the view nor the panel actually adjust their viewing area; but even if it did, the view should automatically adjust its viewing area. which makes it sound like it is becoming associated with the wrong containment?

what sort of panel was it? just a normal, regular panel? can you attach your plasma-desktoprc and plasma-desktop-appletsrc files to this report?

also, if you "kquitapp plasma-desktop; plasma-desktop" after this happens, does it fix it?
Comment 4 Synthetic451 2010-12-08 04:22:41 UTC
It is a regular panel with a task manager widget inside it. I like to have separate task managers for each monitor so I can quickly minimize and maximize windows without having to go to another monitor.

The command you gave me fixes the problem only if I run it after re-enabling my secondary monitor. If I run it while in single monitor mode, none of my windows appear, as if the "view" was covering the entire desktop. Clicking around some more will cause the panel to disappear completely.

Why are we trying to move panels on monitor disconnect anyway? It's a usability hassle when random panels you expect to appear on other monitors appear on your primary.
Comment 5 Aaron J. Seigo 2010-12-08 05:00:29 UTC
"The command you gave me fixes the problem only if I run it after re-enabling my
secondary monitor."

right, so it doesn't fix it. :)

"If I run it while in single monitor mode, none of my windows
appear, as if the "view" was covering the entire desktop. Clicking around some
more will cause the panel to disappear completely."

that sounds very odd indeed.

i'm afraid fixing this one will require having direct access to a machine that can reproduce this issue. so far, i can't.

" It's a usability hassle when random panels you expect to appear on other monitors appear on your primary."

tell that to the numerous people who reported "losing their panel" after disconnecting a monitor.
Comment 6 Synthetic451 2010-12-08 05:22:50 UTC
"right, so it doesn't fix it. :)"

The reason why I said it fixes it is because after I switch back to dual screen, the "view" is still there. Executing your command gets rid of it in dual screen mode, but makes everything worse in single screen.

"tell that to the numerous people who reported "losing their panel" after
disconnecting a monitor."

But then you're hurting users who have panels setup for a specific monitor only. Also often times, the panel is moved behind another panel. What happens if you have more than two monitors? Are you going to place all the panels into one monitor? It's going to be a nightmare trying to move them around and delete them. You should at least offer users a choice in this regard.
Comment 7 Synthetic451 2010-12-08 07:15:18 UTC
Created attachment 54283 [details]
plasma-desktop-appletsrc

Here's the requested files I forgot to include before.
Comment 8 Synthetic451 2010-12-08 07:15:59 UTC
Created attachment 54284 [details]
plasma-desktoprc
Comment 9 Aaron J. Seigo 2010-12-14 05:36:24 UTC
*** Bug 241332 has been marked as a duplicate of this bug. ***
Comment 10 Wouter Haffmans 2011-01-27 16:43:39 UTC
Could bug 259704 be a duplicate of this one? There may be some more useful in there...
Comment 11 Emilio Scalise 2011-04-06 11:21:23 UTC
I have this problem since fedora (13) introduced kde 4.5.x. 
I have a mobility radeon hd4570 and I tried with both r600 open driver and the closed driver.
I also have the effects described in https://bugs.kde.org/show_bug.cgi?id=259704
Now I'm on 4.6.1 version, fedora 14 x86_64. I hoped that this issue could be fixed by the new version, but nothing has changed.
My steps to reproduce the problem:
- start with single screen, standard configuration, set a wallpaper, set folder view as desktop activity
- logout, login, plasma works correctly
- when running kde connect the second monitor plug (CRT). using xrandr from command line or the kde utility (it's the same), enable the second monitor. A black screen will appear (empty plasma containement). Set a second wallpaper and the second desktop as folder view. Add a second default panel and place it below the second monitor (crt).
- logout, login, plasma-desktop is corrupted. You can get alternatively two issues:
    - 2 plasma container one above the other, you can see it because geometry is different (lvds is 1366x768, crt is 1280x1024), windows working correctly
    - plasma container (first monitor, the one you had before with dual monitor configuration as primary, you can notice it seeing the wallpaper you set before) above all windows. You can see windows only using alt-tab or kwin expose-like view. The only solution is to kill plasma-desktop, remove .kde/share/config/plasma-desktop-appletsrc, restart plasma-desktop.

My dirty and ugly, and very annoying workaround is to have two different plasma-desktop-appletsrc, one for single monitor, one for dual monitor. I attach these files on this bug so you can examine them.
Gnome has not these problems, often I use it when I have to switch between single and dual monitor, and that very, very frustating as I love kde.

It seems to be a race condition issue when geometry is changed and plasma-desktop detects it.
Often the panel has also wrong width when you enable the modify button (screenshot attached).

I have also another laptop with nvidia graphic, same fedora system (I cloned it from the radeon laptop one, copying it with rsync, rebuilt initrd, changed driver configurations, binary nvidia driver 260.19.44). I use disper utility (nvidia proprietary extension for changing outputs) or nvidia-settings to enable and disable twinview at runtime. Similar plasma-desktop configuration. I cannot reproduce this bug.
Comment 12 Emilio Scalise 2011-04-06 11:23:13 UTC
Created attachment 58621 [details]
wrong panel width
Comment 13 Emilio Scalise 2011-04-06 11:23:56 UTC
Created attachment 58622 [details]
appletsrc for dual monitor
Comment 14 Emilio Scalise 2011-04-06 11:24:22 UTC
Created attachment 58623 [details]
appletsrc for single monitor
Comment 15 Emilio Scalise 2011-04-06 12:01:14 UTC
I've done additional tests starting with rm -rf .kde

It's definitely the panel on second containement that causes bug.

Fedora 14 x86_64, up to date to today, kde 4.6.1 packages.
Minimal steps to reproduce:
- rm -rf .kde
- start x with single monitor (lvds)
- kde login via kdm
- plug crt monitor, open konsole, xrandr, a popup will be shown asking if you want to configure monitor (that's not automatic and that's bad but this is another bug)
- configure crt as 1280x1024 left of lvds
- add an empty panel and place on the crt monitor. I tried above and below and got same result.
- logout
- disconnect crt
- restart x, so single monitor would be configured
- login, start kde, first time you get containements one above each other bug
- logout
- login, start kde, containement above all windows bug

Aaron now it should be simple for you to reproduce bug.

Bug 259704 should be a duplicate of this..
Comment 16 Synthetic451 2011-05-11 03:07:58 UTC
I still see this in KDE 4.6.3 and it absolutely ruins the multi-monitor experience. Can we get this confirmed please?
Comment 17 Emilio Scalise 2011-05-11 11:21:34 UTC
please add your votes to this bug so some developers will see it!
Comment 18 Stefán Freyr Stefánsson 2011-05-27 03:06:28 UTC
*** This bug has been confirmed by popular vote. ***
Comment 19 Aaron J. Seigo 2011-05-31 23:17:57 UTC
*** Bug 274643 has been marked as a duplicate of this bug. ***
Comment 20 Emilio Scalise 2011-06-07 11:23:02 UTC
bug is still here... :(
My very dirty workaround is switching configuration files plasma-desktop-appletrc killing plasma-desktop before and restarting it after.
Comment 21 John Lloyd-Jones 2011-08-03 20:26:08 UTC
I'm running Natty on a Dell Studio 1535 with Kde 4.6.5 and experience the problems when I disconnect my external monitor. One thing I discovered when windows are lost, is that if I right click on the task bar icon and select Advanced / Keep Above Others, the window magically appears. Not a workaround, but it may cast some light on the root cause.
Comment 22 Craig Fowler 2011-08-24 11:29:59 UTC
Me too!

I am experiencing this exactly as described above with plasma-desktop version 4.6.5 using Debian Testing/Wheezy.  I had previously used version 4.4.5 (from Debian Stable/Squeeze) and this problem did not exist.

Using the workarounds described above I can get a usable desktop on my laptop but it's inconvenient switching plasma config files each time I change monitor configurations.
Comment 23 Emilio Scalise 2011-08-24 12:08:18 UTC
nothing has changed for me.. now fedora 15 + kde 4.6.5...
I always have to switch configuration files before logging in..

No developer loves this bug.. :(
Comment 24 michael.alzheimer@bonitasprint.de 2011-08-24 18:26:30 UTC
Yes, same problem here with kde 4.7.0.
Unfortunately - in office only laptop display, at home another external monitor.

Switching daily 2 times the config isn't very usable..
Comment 25 Henrique Sant'Anna 2011-08-24 19:31:19 UTC
This bug makes me crazy. As a teacher I use VGA output everyday to do my classes, and everyday my desktop crashes or get corrupted.

Since I recommend students to use Linux, my desktop crashing is a shame to me.

Anyway this is a bug very related to those bad graphics drivers. In my case I use the integrated GPU from Intel i5, but also have a ATI Radeon HD 4500 as switchable dedicated GPU (so VGA output is shared between both). My computer also have a HDMI output wich I don't use because Intel's drivers don't support it, and AMD barely does that.

If there is a way to collect information on my computer to contribute to this bug report so please just tell me what to do and I will.
Comment 26 Maxim Levitsky 2011-10-19 02:48:01 UTC
I confirm that is the panel on the second monitor.
Moreover, its the panel (even completely empty panel) that is placed at
_bottom_ of the screen. My current ugly workaround is to place panel on
top of the screen.

also I really, don't want panels of the secondary screen to move to primary.
Think about it: say you have taskbar on primary monitor and taskbar on 2nd monitor. In Gnome2 when you disconnect the 2nd monitor, you have now 2 taskbars
on primary monitor.
So what to do? Remove the 2nd taskbar? But then, when I plug back external monitor, I'll have to recreate the panel and that is quite difficult, as I put there quite a lot of launchers, and widgets.
Comment 27 Emilio Scalise 2011-10-19 11:14:53 UTC
on gnome 2.x I use the hide panel button (enabling it) to hide the second panel when I use only one monitor. That's a workaround but it works.
On kde due to this bug even this is not feasible.
Comment 28 Maxim Levitsky 2011-11-03 20:36:41 UTC
Any update on this?
Comment 29 lundgren 2011-11-29 03:54:25 UTC
I am experiencing this problem with my laptop on opensuse 11.4.  At work I use two monitors, 27" wide one in standard orientation, and one older 19" non wide rotated to portrait. 

When I login without being connected to the external monitors I can't see any menu bars.  When I launch an application off by right clicking, it runs off screen and I can't get it on.

Because of this, I cannot switch from Gnome2 to KDE; and gnome 3 is no where I want to be.  I will try the work around, but it would be nice to have it just work.  (as others mentioned this isn't a problem with gnome 2, and that is as far as I can go for now.)
Comment 30 Reza 2011-12-17 10:42:56 UTC
*** Bug 257847 has been marked as a duplicate of this bug. ***
Comment 31 Marco Pedroni 2012-01-24 14:06:59 UTC
A confirm of the comment #29.
Linux 2.6.37.6-0.9-desktop x86_64
 System: openSUSE 11.4 (x86_64)
 KDE:    4.6.00 (4.6.0) "release 6"
nVidia Corporation
  Model:     GeForce 8600M GT
  Driver 2D: nvidia
  Driver 3D: NVIDIA 290.10
I'm trying (and tried long time) to remove the additional topmost desktop but ... for the moment no way.
Comment 32 Paul van Erk 2012-01-24 14:16:59 UTC
I 'solved' this by going here
http://willem.engen.nl/projects/disper/

And from there on to here
https://github.com/wertarbyte/autorandr (contains auto-disper, as well)

Once I had it set up, I created a script with a while that calls auto-disper and then sleeps for 10 seconds. This script is started during KDE startup. Preferably, a daemon would be better, but not sure if that can do X stuff (and I don't know how to do it).

My situation now: basic X configuration is for laptop only. When I log into KDE and my monitor is connected, it switches automatically to that setup and all works as it should. I rip out the vga cable and tadaaa, it switches back to laptop-only mode. I pick up the laptop, walk to the living room, connect to my TV through HDMI and woosh! My auto-disper TV profile gets activated and my desktop appears only on the TV. It's like magic, really.

This is pretty much how KDE (and Xorg?) should work. I don't have to think about it anymore. Big, big, BIG breath of fresh air.
Comment 33 Maxim Levitsky 2012-02-20 13:35:36 UTC
It even worse now, plasma outright hangs when I disable/enable external monitor.
I hate this.
Comment 34 GODLiKE 2012-02-26 00:44:20 UTC
I have done some minor and quick testing on KDE-4.8 and I would BELIEVE the problem is solved. I have tried what I usually did, unplugging the external monitor and reloading plasma, which usually caused plasma corruption. So far it did not happen. Will keep testing a bit more during the week.
Comment 35 meyerm 2012-04-12 09:23:05 UTC
What are the results of your testing GODLiKE?
Comment 36 Myriam Schweingruber 2012-05-21 22:09:31 UTC
Can somebody confirm this is indeed fixed in 4.8?
Comment 37 lundgren 2012-05-21 22:15:31 UTC
In 4.8.3 on openSuse 12.1 x64 I no longer see the corruption.  

However, the panels from the secondary screen pile up on the primary.  Every time you login without docking with the two monitors, the panels that belong on the secondard screen appear above the ones for the primary screen. You have to delete the panels for the secondary screen, or shrink them down a bit so you can click on the panel behind it (for the primary screen) to pull those to the top.  

Then when you do connect a second monitor, you have to move the primary one out of the way, grab the secondary one, put it on the secondary monitory, then if you previously shrunk it, make it the right size.  Then go back and move the primary one back to where it was.

It is MUCH better than crashing, but not perfect yet.
Comment 38 lundgren 2012-05-21 22:20:12 UTC
Also with 4.8.3 I have seen frequent plamsa hangs when switching from one to two monitors.  To fix it I open a term, kill plasma and manually start it again.  Once the two monitors are running, it is happy enough to use them. It has been a week or so since I have seen that though, so it might be fixed for the moment.

kdebase4-runtime-4.8.3-376.2.x86_64
kdebase4-workspace-plasma-engine-akonadi-4.8.3-756.2.x86_64
Comment 39 Myriam Schweingruber 2012-05-21 23:13:24 UTC
(In reply to comment #37)
> In 4.8.3 on openSuse 12.1 x64 I no longer see the corruption.  
> 
> However, the panels from the secondary screen pile up on the primary.  Every
> time you login without docking with the two monitors, the panels that belong
> on the secondard screen appear above the ones for the primary screen. You
> have to delete the panels for the secondary screen, or shrink them down a
> bit so you can click on the panel behind it (for the primary screen) to pull
> those to the top.  
> 
> Then when you do connect a second monitor, you have to move the primary one
> out of the way, grab the secondary one, put it on the secondary monitory,
> then if you previously shrunk it, make it the right size.  Then go back and
> move the primary one back to where it was.
> 
> It is MUCH better than crashing, but not perfect yet.

Thank you for the feedback. These other problems should be reported in a separate bug IMHO, as the basic problem reported in this bug is gone. I seem to remember similar problems already reported, please check if this problem is not already reported as well before filing a new bug.