Bug 228031

Summary: plasma panel alignment not remembered after relogin
Product: [Unmaintained] plasma4 Reporter: Kai Krakow <kai>
Component: panelAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aseigo, asraniel, nexor, senjas
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Kai Krakow 2010-02-22 12:35:53 UTC
Version:            (using KDE 4.4.0)
OS:                Linux
Installed from:    Gentoo Packages

Plasma incorrectly restores panel alignments after re-login or plasma restart. Only panels aligned left, right, centered or full-width are restored correctly.

But I have one panel which is arbitrarily aligned about 100 pixel from the right screen edge. Upon restart of the session the panel is moved to the right screen edge while it still has the same width. This is pretty annoying as it usually covers close/minimize buttons of maximized application title bars. Aligning the bar centered is not a satisfying workaround as it covers the window titles then.
Comment 1 Kai Krakow 2010-06-25 19:30:44 UTC
Another issue which may be related:

Attach two panels to the same screen edge, one aligned left, one right. Leave the session, relogin. Both panels now have the same setting applied (alignment, height, ...).
Comment 2 Andrey 2010-08-14 21:32:09 UTC
It is a very old bug. 
I have a convertible table PC with a lot of panels 
and an external monitor, so I have had a good 
oportunity to enjoy all its gladness.
But I always thought, that it will be fixed 
in next release, since KDE was not mature enough.
 
So I constantly fight with Plasma for my panels.
I have seen that "inconsistent panels positions and size" 
from version 4.1* to 4.5.0 .

Now I am on 4.5.0, so I will write about that.

'Random' panel position changes are triggered by:
1) Restarting plasma
2) Changing screen resolution (e.g. switching to another monitor)

I even tried manually editing plasma-desktoprc , 
but Plasma removes offset very consistently 
for one of my panels. Other seem fine at the moment, 
but under some conditions, which are pretty hard to track 
cause all panels to reset their position.
In that case I do 
1) killall plasma-desktop 
2) replace 'broken' configuration files 
    with those, where all panels were in place
3) start plasma-desktop again

Saves a lot of time, because I don't need 
to reposition ALL my panels yet for the 100th time.

Let's see how this stubborn panel looks in plasma-desktoprc:

[PlasmaViews][99]
Alignment=132
Offset=89
panelVisibility=3

[PlasmaViews][99][Sizes]
lastsize=800

[PlasmaViews][99][Sizes][Vertical1280]
max=27,174
min=27,174
offset=89
size=27,174

[PlasmaViews][99][Sizes][Vertical800]
max=27,174
min=27,174
offset=89
size=27,174

As you see, there are one 'global' section
and several corresponding to different screen resolutions.
I suppose, settings for each particular resolution 
are independent. At least that would be resonable.

'Alignment' is global setting. As *I guess*, 
if you don't count the side of the screen 
where the panel is (fortunately, Plasma always remembers it),
there are 4 options for this: left, right, center and maximized.
So panel should have one of those alignments.  

The thing, which resets upon Plasma restart 
(or other conditions) is *offset*.
If it happens, all panels go to their initial position
(right, left or centered). 
So if you have several which are on the left,
they will be superimposed on each other.

I tried killing plasma-desktop and writing offset
manually to all this sections including 'global' section.
Upon restart plasma overwrites one or several of the offsets,
so it becomes =0 . And I have not found a way to prevent it. 

( Note that 'global' Offset begins from the capital letter,
while [Sizes] have 'offset' - all lowercase.
Quite strange syntax, isn't it? )

Sometimes there are problems with panel sizes too.
Even if min and max are set to the same setting.
And sometimes height of the panel chages too.
These changes are triggered by resolution changes 
or plasma-desktop restart. I think that is related to this bug.

If you can code in C++, I think you can anylize this:
http://websvn.kde.org/trunk/KDE/kdebase/workspace/plasma/desktop/containments/panel/panel.cpp?annotate=1158160
That seems to be the code for panel handling.
I tried reading it, but it is quite hard for me,
as there are not very much of comments and I do not know C++.
Comment 3 Andrey 2010-08-15 03:59:22 UTC
OK, now I have it:

(1) If I start plasma-desktop within layout 
   which includes second non-primary monitor
   (internal is still set as --primary via xrandr)
   
   *ALL* my panels move to initial positions (offset is reset for all of them).
   
   Note, that screen where panels are does not change its dimensions
   since last plasma-desktop session, since panels are still 
   on the same monitor, which is set as primary.
   Reproducible 100 %.

(2) If I logout and then login without a monitor connected
   offset is reset for one particular panel of my setup.
   Reproducible 100 %.

(3) So if I logged in normally without second monitor connected,
   fixed that panel position and then connect another monitor 
   via xrandr as secondary everything is fine...
   unless plasma-desktop crashes (of course its cucumber-solid, 
   but it crashes sometimes nonetheless).
   So If I start it again it sees, that second non-primary monitor
   is connected and resets my panel positions just like in case (1)
   Reproducible 100 %.

As I wrote earlier, actual offsets not always correspond
to the ones in configuration file plasma-desktop.
But once Plasma decides that I don't need any offsets
it just resets them irrespective to the configuration file 
and *usually* overwrites corresponding offsets to 0 in configuration file too.

I guess now it is all I can say. 

I don't get why should it change settings by itself...
Comment 4 Aaron J. Seigo 2010-12-15 23:05:18 UTC
SVN commit 1206789 by aseigo:

there were two ways of storing/reading the offset (globally in Offset and per-resolution in offset) and three implementations of calculating offsets that respect screen boundaries (only one of which repsected panel alignment settings). remove all the duplication, make things consistent ... offsets now work properly and reliably. with 69 fewer lines of code that we started with. best kind of bug fix, really ;)
BUG:228031


 M  +14 -85    panelview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1206789
Comment 5 Aaron J. Seigo 2010-12-15 23:06:54 UTC
hm. 71 fewer lines as it turns out. cleaned up a final thing before commit and didn't recount.. but there it is -85 +14. woo.
Comment 6 Beat Wolf 2010-12-15 23:57:00 UTC
aseigo, did you accidentaly reopen this with your last commit or is it really not fixed?