Bug 241332 - [regression] Panels messed up when the second screen is off
Summary: [regression] Panels messed up when the second screen is off
Status: RESOLVED DUPLICATE of bug 259183
Alias: None
Product: plasma4
Classification: Plasma
Component: multiscreen (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 242662 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-10 19:33 UTC by Anselmo L. S. Melo (anselmolsm)
Modified: 2010-12-14 05:36 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
plasma-desktoprc (289 bytes, application/octet-stream)
2010-06-10 23:06 UTC, Anselmo L. S. Melo (anselmolsm)
Details
panels overlap (924.30 KB, image/png)
2010-06-12 01:23 UTC, Anselmo L. S. Melo (anselmolsm)
Details
screenshot showing empty area (481.82 KB, image/png)
2010-09-01 03:09 UTC, Anselmo L. S. Melo (anselmolsm)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anselmo L. S. Melo (anselmolsm) 2010-06-10 19:33:52 UTC
Version:           unspecified (using Devel) 
OS:                Linux

My setup: A notebook connected to an external monitor, both displays in use ( NVidia TwinView mode).

I have a plasma panel in each screen. When I remove the external monitor and restart KDE, both panels appear stacked on the same screen, then I need to remove one of them. When the second monitor is present, I need to add a panel again.

It was marked as a regression because it worked fine until a few days ago.

Reproducible: Always

Steps to Reproduce:
1 - connect a second monitor;
2 - add panels to each screen;
3 - logout (or turn off the machine) and remove the second monitor;
4 - start KDE.

Actual Results:  
The second screen's panel appears stacked on top of the first screen's panel.

Expected Results:  
Just the first screen's panel

KDE svn trunk r1136331
Qt 4.6.3
openSUSE 11.2
NVIDIA Driver 195.36.15

I can provide more details if needed.
Comment 1 Aaron J. Seigo 2010-06-10 22:46:16 UTC
more details are needed, yes. in particular:

* the size of the panels (can just attach your plasma-desktoprc file, even)
* the resolution of the monitors
Comment 2 Anselmo L. S. Melo (anselmolsm) 2010-06-10 23:06:07 UTC
Created attachment 47875 [details]
plasma-desktoprc

resolutions
primary display: 1440x900
extra monitor: 1920x1200
Comment 3 Marco Martin 2010-06-11 22:57:58 UTC
aaron:
you made the panels migrate when a screen is turned off a while ago
that's coorect, but if the effect is that users remove the migrated panel, that is a bit of a problem.
i think that's an intended behaviour, if it really works i don't know
Comment 4 Aaron J. Seigo 2010-06-11 23:48:52 UTC
@Anselmo: do the panels overlap on the single screen when the second screen is disconnected? could you attach a screenshot of the post-migration to this report?

@Marco: we got fairly constant feedback about wanting this as the desired behaviour, and it makes sense in the most common of cases. i suppose we could add a confirmation dialog asking the user if they want to move the panel ... i'd like to avoid doing that if at all possible though. one thing that it currently already checks for (or is supposed to) is whether or not the panels overlap, and if they do, not to move the panel over. it seems like that isn't working, however.
Comment 5 Anselmo L. S. Melo (anselmolsm) 2010-06-12 01:23:56 UTC
Created attachment 47919 [details]
panels overlap

@Aaron: Yes, they overlap. Snapshot attached.
Comment 6 Aaron J. Seigo 2010-06-12 02:04:21 UTC
do you build from source? if so, could you apply a patch and get some additional debug output for us? if so, i'll attach it to this bug report ...
Comment 7 Anselmo L. S. Melo (anselmolsm) 2010-06-12 04:43:26 UTC
Yep, I build KDE from sources and I can test your patch =)
Comment 8 Aaron J. Seigo 2010-06-16 01:53:26 UTC
do you compile from svn? if so, can you svn up and build kdebase/workspace/plasma/desktop/shell/ and look for output that contains PlasmaApp::canRelocatePanel when you replicate the problem? if you don't compile from svn, i'll attach a patch to the bug report ...
Comment 9 Anselmo L. S. Melo (anselmolsm) 2010-06-17 15:30:02 UTC
Yes, I compile from svn.

I reproduced the scenario "moving from the 2 screens to single screen setup".

In the output:

PlasmaApp::canRelocatePanel: testing: 0 PanelView(0x8dc73f0) QRect(0,0 1920x35) 3 QRect(1440,0 480x35)

Moving back to '2 screens setup', no PlasmaApp::canRelocatePanel in the output.
Comment 10 Marco Martin 2010-06-24 14:37:35 UTC
*** Bug 242662 has been marked as a duplicate of this bug. ***
Comment 11 Aaron J. Seigo 2010-06-24 20:05:37 UTC
PlasmaApp::canRelocatePanel: testing: 0 PanelView(0x8dc73f0) QRect(0,0 1920x35)
3 QRect(1440,0 480x35)

that's it? just the one line? 

aaah, because the other panel hasn't been created yet! so this is caused by the panel creation order *goes off to fix*
Comment 12 Aaron J. Seigo 2010-06-24 20:24:10 UTC
SVN commit 1142367 by aseigo:

when the containment screen changes, pinch.
CCBUG:241332


 M  +1 -0      panelview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1142367
Comment 13 Aaron J. Seigo 2010-06-24 20:30:11 UTC
SVN commit 1142369 by aseigo:

* don't keep panel views around for screens that don't exist
* relocate panels only after all panels that should have views have been set up; prevents errors due to containment loading order
BUG:241332


 M  +22 -14    plasmaapp.cpp  
 M  +2 -1      plasmaapp.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1142369
Comment 14 Aaron J. Seigo 2010-06-24 20:30:58 UTC
ok, that _should_ fix the issue seen by the original reporter. if you can please test and confirm, that would be great :)

thanks for the follow ups, they were critical to understanding and fixing this issue.
Comment 15 Anselmo L. S. Melo (anselmolsm) 2010-06-29 15:45:30 UTC
hm... I was traveling, couldn't test it before. I recompiled KDE trunk with svn r1143681 and unfortunately the problem still happening.

I'll try to check the code later, maybe it's easier to fix here as I'm running KDE in the problematic setup.
Comment 16 Beat Wolf 2010-07-07 23:03:41 UTC
i can reproduce with 4.5 rc1
Comment 17 Ron Petrick 2010-07-27 18:22:47 UTC
I can confirm that the original problem is still present in 4.5 RC3 on Fedora 13. I can provide any config files or logs if you need additional information.
Comment 18 Aaron J. Seigo 2010-07-28 04:57:13 UTC
if you want this fixed in 4.5.0 (or any subsequent release, for that matter), someone with a machine to duplicate this is going to have to step up and so some work. i'm coding in the dark here with a single screen laptop. 

the relevant code is in 

kdebase/workspace/plasma/desktop/shell/plasmaapp.cpp

in PlasmaApp::createWaitingPanels()

one possibility is that the event loop gets re-entered between panels being created and so createWaitingPanels() gets called with an incomplete list of panels.

it could be a simple matter of changing m_panelViewCreationTimer.setInterval(0); to a higher number to allow enough time for all the panels to be created. though if that's the case, that would seem to be a bit of a hack.

perhaps putting a guard around c->initializeLayout(); in PlasmaApp::corona() and not starting m_panelViewCreationTimer until it is done...

but really, this needs to be done on a machine that cn be used to test and reproduce.
Comment 19 Aaron J. Seigo 2010-07-28 05:01:06 UTC
SVN commit 1155782 by aseigo:

delay creation of the initial views until everything is set up; might help with BR241332
CCBUG:241332


 M  +6 -2      plasmaapp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1155782
Comment 20 Aaron J. Seigo 2010-07-28 05:01:53 UTC
SVN commit 1155783 by aseigo:

delay creation of the initial views until everything is set up; might help with BR241332
CCBUG:241332


 M  +6 -2      plasmaapp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1155783
Comment 21 Ron Petrick 2010-07-28 18:20:19 UTC
I rebuilt the Fedora RPMs with this patch applied and it doesn't seem to make a difference. 

After running in dual head mode and adding a panel to the second display, moving to a single head setup caused the panels to be "stacked" on the first display. The panels remained stacked on the first display after moving back to a dual head setup.
Comment 22 Aaron J. Seigo 2010-07-29 05:27:26 UTC
*sigh* well, thanks for testing. it's now up to someone with such a machine to test.
Comment 23 Anselmo L. S. Melo (anselmolsm) 2010-07-31 06:38:51 UTC
Ok, I spent some time reading this code and making tests / checking debug output / trying to fix it, with no success until now/

I'll divide the results in 2 cases:

1) The transition between 2 monitors -> 1 monitor happens while plasma-desktop is not running (i.e., planels placed by setupDesktop)

One thing I noticed is that the in this case the comparison pv->screen() == screen->id() in canRelocatePanel is always false, what makes this method returns true. So, once we have a panel candidate to be relocated, it is going to be relocated, independent of the other conditions.

Without that verification, panel overlaps does not happen anymore.
Panels in different positions than the ones in the primary screen are relocated.

---

2) The second screen is turned off while plasma-desktop is running (i.e., screenRemoved in action):

pv->screen() == screen->id() is always true (at least it happened in every test). The problem seems to be pv->geometry().intersects(newGeom) because its result change during the process, probably due to an update in the geometry of the panel being analysed.

----

In both cases, if the extra monitor reappear, nothing happens with the panels (the ones originally from the extra screen are not reset to the original position).

---

Well, this is what I found today. Consider that it was my first contact with this part of plasma code, so I probably skipped something important in these tests. 


A question that comes to my mind is: Why one would be interested in mixing panels from different screens when running the "single screen"? Besides that, when the 2 monitors setup is restored, panels need to be moved manually.
I don't know, it sounds weird and I got the feeling it is over engineering to solve a very particular use case.

Well, that's all for today, I'm sleepy, I can't even review this text, sorry in advance about any stupid thing written here.
Comment 24 Michal 2010-08-24 20:59:17 UTC
Maybe better solution of this bug would be to switch the primary screen on the internal display after disconnecting the external monitor. 

Now it only moves all panels from disconnected monitor/screen to the connected but this will always mess up the panels !!! And even worse is that after reconnecting the external monitor back it forgets positions (original screens) of all panels and move them all to the external screen. 

If would you just switch the primary screen with its panels (I saw primary screen setting in the trunk version in monitor setting) to the remaining monitor it would be more expected behavior.
If the main screen will be on the internal monitor nothing will happen and it will behave like in kde4.4.
If the main screen will be on the external monitor it will jump on the remaining monitor with all panels and widgets.
Comment 25 Lukas 2010-08-30 14:01:39 UTC
Same thing happens on openSUSE 11.3 just updated to 4.5. In 4.4 ir worked fine.

I just don't get one thing, why at all panel is going to be moved, if the screen is gone? The best solution, i think, is just to leave them as they where. If the screen with panel is removed, there is no need to change anything, panel disappears, and , even more importantly, next time external display is connected, it is placed, where it should be :)Same thing happens on openSUSE 11.3 just updated to 4.5. In 4.4 ir worked fine.

I just don't get one thing, why at all panel is going to be moved, if the screen is gone? The best solution, i think, is just to leave them as they where. If the screen with panel is removed, there is no need to change anything, panel disappears, and , even more importantly, next time external display is connected, it is placed, where it should be :)
Comment 26 Anselmo L. S. Melo (anselmolsm) 2010-08-30 18:42:43 UTC
(In reply to comment #25)
> I just don't get one thing, why at all panel is going to be moved, if the
> screen is gone? The best solution, i think, is just to leave them as they
> where. If the screen with panel is removed, there is no need to change
> anything, panel disappears, and , even more importantly, next time external
> display is connected, it is placed, where it should be :)

I agree with you. That's the way it used to work in 4.4.

It seems there are 2 groups of users with different opinions about what should happen when an extra screen is removed. As the group who prefer the current scenario (post 4.5) won't either read or post opinions in this bug report, I think we should discuss this issue in a more visible place (reviewboard? kde forum? mailing list?).
Comment 27 Michal 2010-08-30 19:20:55 UTC
Exactly, one group get used to the behavior in KDE4.4, it wasn't bad but you needed to have panel with all widgets (tasks, system, clock, ..) on both screens. 
And then there is second group used to "Windows behavior" => one panel always on the current main screen (this is the only way how it works now). 
As I wrote in my previous comment, I believe that the correct way is let user choose the "main screen" and this screen will switch on the internal screen after disconnecting (with all its panels). When the external screen will be reconnected it should return back to the previous state !!, not like now when it forgets positions (original screens) of all panels.
Comment 28 G Cohen 2010-08-30 19:25:50 UTC
I also agree and this bug/feature is the only thing that stops me from upgrading to KDE 4.5. 
As a solution, is it not possible to have a setting somewhere for user to select whether they want the old functionality or the new?
Comment 29 Anselmo L. S. Melo (anselmolsm) 2010-08-30 19:37:47 UTC
(In reply to comment #27)
> Exactly, one group get used to the behavior in KDE4.4, it wasn't bad but you
> needed to have panel with all widgets (tasks, system, clock, ..) on both
> screens.

Not necessarily, I had one panel with a specific set of plasmoids on the main screen (the notebook's screen) and another set of plasmoids on the monitor screen. As the extra monitor was present only in the office, the panel had plasmoids useful during my workday.

(In reply to comment #28)
> As a solution, is it not possible to have a setting somewhere for user to
> select whether they want the old functionality or the new?

Maybe... yet another setting, but in this case I don't see another alternative.
Comment 30 Aaron J. Seigo 2010-08-30 20:44:14 UTC
"I just don't get one thing, why at all panel is going to be moved, if the
screen is gone?"

because it is (apparently) unexpected that panels are no longer accessible just because a screen is removed. we received numerous bug reports about this. it is compounded by the fact that some (rather common) x.org drivers rearrange the screen numbering when screens are added (and not symmetrically to how the numbering is handled when the screen is removed).

"As a solution, is it not possible to have a setting somewhere for user to
select whether they want the old functionality or the new?"

that's not a solution, that's a workaround.
Comment 31 Aaron J. Seigo 2010-08-30 21:03:01 UTC
SVN commit 1170103 by aseigo:

give panels a chance to initialize before checking them over for screen, etc.
CCBUG:241332


 M  +20 -8     plasmaapp.cpp  
 M  +6 -1      plasmaapp.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1170103
Comment 32 Aaron J. Seigo 2010-08-30 21:06:14 UTC
r1170105 also applies to this report.
Comment 33 Aaron J. Seigo 2010-08-30 22:04:41 UTC
SVN commit 1170125 by aseigo:

migrate back to screens when they re-appear
CCBUG:241332


 M  +25 -0     panelview.cpp  
 M  +3 -0      panelview.h  
 M  +9 -2      plasmaapp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1170125
Comment 34 Aaron J. Seigo 2010-08-30 22:07:16 UTC
hopefully with those last three commits things should be working better; i need someone with kdebase/workspace/plasma/desktop/shell/ from trunk to test and confirm. if all is good, i'll backport the changes.
Comment 35 Anselmo L. S. Melo (anselmolsm) 2010-08-30 22:17:50 UTC
Aaron, I running trunk, I can test your changes tonight.

If anybody else can test it before, no problem =)
Comment 36 Anselmo L. S. Melo (anselmolsm) 2010-08-31 16:33:45 UTC
Tests done and it seems to work here =)

The only wrong thing I noticed is that if I put a panel on the second screen, after this screen removal an area equivalent to that panel appears in the first screen - looks like a transparent panel. Plasmoids and windows are covered by this area, but the panel itself is not there.
Comment 37 Michal 2010-08-31 17:33:11 UTC
I can confirm comment #36, when external monitor is disconnected the windows can't be moved to area of panels that moved out from the screen (primary screen moved to the internal monitor, works nice). And when the external monitor is reconnected on the primary screen (that moved back to the external monitor) appears area in shape of panel from secondary screen where the windows cropped.

Snapshot of primary screen after disconnecting the external monitor:
http://yfrog.com/ne1screenp

Snapshot of both screens after reconnecting the external monitor, (primary is the right):
http://yfrog.com/nb2screensj
Comment 38 Aaron J. Seigo 2010-09-01 00:06:04 UTC
@Anselmo: "The only wrong thing I noticed is that if I put a panel on the second screen,
after this screen removal an area equivalent to that panel appears in the first
screen - looks like a transparent panel. Plasmoids and windows are covered by
this area, but the panel itself is not there."

can you click in that area? e.g. if you put a window in this area, does it receive clicks? can you attach a screenshot? thanks :)

@Michal: "when the external monitor is reconnected on the primary screen (that moved back to the external monitor) appears area in shape of panel from secondary screen where the windows cropped."

that looks like a graphics driver and/or a kwin compositing (if it happens when desktop effects are on) bug, but it might not be. can you answer the same questions i asked Anselmo above? thanks ...
Comment 39 Aaron J. Seigo 2010-09-01 00:54:56 UTC
SVN commit 1170446 by aseigo:

backport fixes for:
CCBUG:241332


 M  +25 -0     panelview.cpp  
 M  +3 -0      panelview.h  
 M  +30 -11    plasmaapp.cpp  
 M  +6 -1      plasmaapp.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1170446
Comment 40 Anselmo L. S. Melo (anselmolsm) 2010-09-01 03:09:39 UTC
Created attachment 51158 [details]
screenshot showing empty area

(In reply to comment #38) 
> can you click in that area? e.g. if you put a window in this area, does it
> receive clicks? can you attach a screenshot? thanks :)

Windows in this area don't receive clicks, however I can open the desktop context menu with a right mouse button click there.

In the attachment you can see that part of the left panel is covered by the area, the top of dolphin window as well. KRunner and the batery plasmoid are not covered.
Comment 41 Michal 2010-09-01 09:33:54 UTC
(In reply to comment #38)
> that looks like a graphics driver and/or a kwin compositing (if it happens when
> desktop effects are on) bug, but it might not be. can you answer the same
> questions i asked Anselmo above? thanks ...

With compositing on it is still the same. It behaves exactly as Anselmo wrote. 

@Anselmo: Do you get the same problem if you reconnect the external screen back ? Can you try configuration of panels like in the snapshot http://yfrog.com/nb2screensj ?
Comment 42 Anselmo L. S. Melo (anselmolsm) 2010-09-01 14:27:19 UTC
(In reply to comment #41)
> @Anselmo: Do you get the same problem if you reconnect the external screen back
> ?

Yes, if I reconnect the external screen the empty area remains in the first screen - I have to remove the panel to fix the first screen.

Can you try configuration of panels like in the snapshot
> http://yfrog.com/nb2screensj ?

I tested this configuration, the problem happens only if the the external screen is the one with the panel placed on the top.

After that, I made another tests and found that the problem *does not happen* if the 2nd screen panel is on the bottom. However, the issue reappears when this panel is in any other position (top, left, right).

Also, I can't reproduce this behavior when both screen's panels are placed at the same position (top x top, bottom x bottom, right x right, left x left)
Comment 43 Aaron J. Seigo 2010-12-14 05:36:24 UTC

*** This bug has been marked as a duplicate of bug 259183 ***