Bug 375507 - blank plasmadesktop containment is created when cloning display
Summary: blank plasmadesktop containment is created when cloning display
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop Containment (show other bugs)
Version: 5.9.2
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Sebastian Kügler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-24 16:30 UTC by Thomas Weissel
Modified: 2017-03-02 16:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
plasma applets config (4.75 KB, text/plain)
2017-01-25 20:16 UTC, Thomas Weissel
Details
plasmashell config (248 bytes, text/plain)
2017-01-25 20:16 UTC, Thomas Weissel
Details
output of kscreen-console (2.86 KB, text/plain)
2017-01-26 18:59 UTC, Thomas Weissel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Weissel 2017-01-24 16:30:22 UTC
steps to reproduce:

# configure desktop and fill it with widgets
# attach projector
# clone display to projector
# restart xserver

the file: plasma-org.kde.plasma.desktop-appletsrc gets a new entry like this:

[Containments][73]
activityId=95dec76c-3e71-47af-a064-cbd5a50957de
formfactor=0
immutability=1
lastScreen=2
location=0
plugin=org.kde.desktopcontainment
wallpaperplugin=org.kde.image

>> all desktop widgets are gone

the old entry :

[Containments][1]
activityId=95dec76c-3e71-47af-a064-cbd5a50957de
formfactor=0
immutability=1
lastScreen=0
location=0
plugin=org.kde.desktopcontainment
wallpaperplugin=org.kde.image

and all it's associated [Applets] are still there but not shown.


pressing "meta+tab" or accessing the activity switcher (or pressing "alt+tab" without running applications) immediately switches back to containment #1 instead of containment #73 and all widgets are visible again.


i switched the lastScreen values so that containment #73 has lastScreen=0 > restarted the desktop > everything worked.. all my widgets are here (i'm still able to switch to the empty containment from the parallel universe with meta+tab)

the problem is that the moment i disconnect the projector and restart the desktop the containment with lastScreen=0 is shown (ergo the empty one) 

it seems i can't have both..



there is no other desktop configured and no other activity - plasmashell is doing this automatically but this new "hidden" containment does not show up anywhere except in the config file..


reproduceable: ALWAYS!

here is a short video of this strange behaviour:
https://www.youtube.com/watch?v=95z7yuZQLCo


IMHO creating another desktop containment entry in the config file is fine for big-desktop but clone-desktop should not do this - it should just clone the current one!

is there a quick fix for that?
Comment 1 Thomas Weissel 2017-01-24 16:33:08 UTC
oh.. and if you try to add widgets to a fresh installation (new config file) already cloned -  they appear on the screen but then dissappear to the "hidden" second containment the moment you try to move them..  only after a reboot it is possible to add widgets to the current visible screen AND move them without changing to the other conainment...   weird !?
Comment 2 Thomas Weissel 2017-01-25 09:22:28 UTC
oke..  i think i can describe it a little bit better now:

the moment you add a second display your plasma-org.kde.plasma.desktop-appletsrc gets a new entry > a new containment for the same activity id that looks like this:

[Containments][73]
activityId=95dec76c-3e71-47af-a064-cbd5a50957de
formfactor=0
immutability=1
lastScreen=2      <<<<<  !!!!!
location=0
plugin=org.kde.desktopcontainment
wallpaperplugin=org.kde.image

this containment has no "applets" and therefore is empty
that is ok for the default setup where the new display extends the first one to the left or to the right (big desktop)

BUT the moment you move the first display over the second (in systemsettings or with xrandr) in order to "clone" the displays (display the same content on both screens) it becomes a problem..

plasma seems to randomly chose which containment is shown on the screens!!

new widgets are placed on the primary screen1 containment (and you can see that if you are lucky and this is the one containment that is currently displayed) but the moment you move them they switch to the secondary (empty) contaiment for screen2 (somehow behind the current containment)

by pressing meta+tab you can switch between those two contaiments and change the "stack" order..  it seems that sometimes (in my case after every boot) the containment of screen2 acts as overlay over screen1 containment.  

IMHO they should always have the same content in "clone" mode and the user should never be able to see (or even switch) between those to..  OR..  the containment of any other screens that are not marked as primary should be rigorously ignored
Comment 3 Thomas Weissel 2017-01-25 20:16:26 UTC
Created attachment 103646 [details]
plasma applets config
Comment 4 Thomas Weissel 2017-01-25 20:16:43 UTC
Created attachment 103647 [details]
plasmashell config
Comment 5 Thomas Weissel 2017-01-25 20:16:54 UTC
here is a more detailed video that shows attaching the beamer and the handling of the applets 

you can see how the current containment is replaced with a blank new one and how applets are placed on the initial containment and disappear to the new one the moment you try to move them.

https://www.youtube.com/watch?v=7bREB1tOf8M
Comment 6 Marco Martin 2017-01-26 17:01:49 UTC
here is a way i could "kindof" reproduce that:
first, there is no such thing as "cloning": what happens is that the two screens have a geometry that is either partially or completely overlapping.
in the case one screen is fully contained in the other one, the smallest screen is *not* assigned a containment.

but, if they are not completely overlapping, both containments are created, and you will have two desktop windows with two containments, one on top of the other (and clicking around may also bring the other in front, giving the impression of this containment switching): the fact that plasmashellrc has ids for both screens in it, tells me that may be what is happening

if this is correct, if you adjust the relative screen position in the way the smaller projector is completely contained in the other screen, the problem should go away.

https://www.youtube.com/watch?v=7bREB1tOf8M also suggests this is the problem looking at when you bring the screens one on top of the other.

can you paste the output of the following command?
kscreen-doctor -j
Comment 7 Thomas Weissel 2017-01-26 18:59:01 UTC
well..
what you can't see in the video is that the screenmanagment tool in systemsettings says [0,0] in the corner (so it thinks they are exactly overlapping) but as seen in the video there is an offset nevertheless..  i changed that in the video immediately so that both windows are precicely on top of each other..

in my classroom installations i'm not doing it manually.. i use..

exec xrandr --output LVDS --mode 1024x768 --primary --set "scaling mode" Center --output VGA-0 --mode 1024x768 --same-as LVDS &

this should do it right? 

i've got no kscreen-doctor.. where can i find that? 

meanwhile i attach the output of kscreen-console

thx
Comment 8 Thomas Weissel 2017-01-26 18:59:21 UTC
Created attachment 103658 [details]
output of kscreen-console
Comment 9 Marco Martin 2017-01-27 13:58:31 UTC
managed to reproduce, and the problem is that the two screens have the same resolution: which is a case that wasn't managed correctly
patch adressing this:
https://phabricator.kde.org/D4309
Comment 10 Marco Martin 2017-01-27 15:43:45 UTC
Git commit 996f5b199f40ade64b4d833f5ece5300c582670c by Marco Martin.
Committed on 27/01/2017 at 15:43.
Pushed by mart into branch 'master'.

fix isOutputRedundant logic

Summary:
isOutputRedundant badly failed when two screens had
the exact same geometry (that should be, the base
case for "cloning" screens.
now the logic is:
a screen is redundant if:
* its geometry is contained in another one
* if their resolutions are different, the "biggest" one wins
* if they have the same geometry, the one with the lowest id wins (arbitrary, but gives reproducible behavior and makes the primary

Test Plan:
tested with two screens:
* overlapping, same resolution: the lowest id (0, the primary) wins, the other one doesn't get a view
* overlapping, different resolutions: the biggest one wins
* not overlapping: both get a view

Reviewers: sebas, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4309

M  +30   -5    shell/shellcorona.cpp

https://commits.kde.org/plasma-workspace/996f5b199f40ade64b4d833f5ece5300c582670c
Comment 11 Marco Martin 2017-01-27 15:45:12 UTC
Git commit 3792ef9e51dc0ba21740e69964f26e241df7aed2 by Marco Martin.
Committed on 27/01/2017 at 15:44.
Pushed by mart into branch 'Plasma/5.8'.

fix isOutputRedundant logic

Summary:
isOutputRedundant badly failed when two screens had
the exact same geometry (that should be, the base
case for "cloning" screens.
now the logic is:
a screen is redundant if:
* its geometry is contained in another one
* if their resolutions are different, the "biggest" one wins
* if they have the same geometry, the one with the lowest id wins (arbitrary, but gives reproducible behavior and makes the primary

Test Plan:
tested with two screens:
* overlapping, same resolution: the lowest id (0, the primary) wins, the other one doesn't get a view
* overlapping, different resolutions: the biggest one wins
* not overlapping: both get a view

Reviewers: sebas, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4309

M  +30   -5    shell/shellcorona.cpp

https://commits.kde.org/plasma-workspace/3792ef9e51dc0ba21740e69964f26e241df7aed2
Comment 12 Marco Martin 2017-01-27 15:45:12 UTC
Git commit f4faa6f1547c4994893ac5f7a5c251f2846368f0 by Marco Martin.
Committed on 27/01/2017 at 15:44.
Pushed by mart into branch 'Plasma/5.9'.

fix isOutputRedundant logic

Summary:
isOutputRedundant badly failed when two screens had
the exact same geometry (that should be, the base
case for "cloning" screens.
now the logic is:
a screen is redundant if:
* its geometry is contained in another one
* if their resolutions are different, the "biggest" one wins
* if they have the same geometry, the one with the lowest id wins (arbitrary, but gives reproducible behavior and makes the primary

Test Plan:
tested with two screens:
* overlapping, same resolution: the lowest id (0, the primary) wins, the other one doesn't get a view
* overlapping, different resolutions: the biggest one wins
* not overlapping: both get a view

Reviewers: sebas, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4309

M  +30   -5    shell/shellcorona.cpp

https://commits.kde.org/plasma-workspace/f4faa6f1547c4994893ac5f7a5c251f2846368f0
Comment 13 Marco Martin 2017-01-27 15:50:42 UTC
next week a neon developer edition with this patch should come up.
you can try it on one of those machines with that setup to see if it still happens
Comment 14 Thomas Weissel 2017-01-27 16:11:34 UTC
thanx a lot !  i'm definitely going to test it...  

is there any chance that this fix is going to be in 5.8.6 ? (because for my classrooms im betting on the LTS )
Comment 15 Thomas Weissel 2017-02-01 07:06:42 UTC
I just tried the setup on kde plasma 5.9.0  (neon packages) 
i deleted all of the old config files first, setup the desktop containment with widgets and then tried to "clone" the desktop to the beamer...

unfortunately nothing changed !  

the moment i plug in a beamer and call 
>> xrandr --output LVDS --mode 1024x768 --primary --set "scaling mode" Center --output VGA-0 --mode 1024x768 --same-as LVDS &

a new containment is created and used as primary containment on top of the one i configured before...  
i still can switch to the original one by pressing meta+tab


did the fix make it to 5.9 in time ?
Comment 16 Marco Martin 2017-02-01 08:51:43 UTC
(In reply to Thomas Weissel from comment #15)
> unfortunately nothing changed !  

It didn't make into 5.9.0, should be in 5.9.1
Comment 17 Thomas Weissel 2017-02-08 19:26:36 UTC
Unfortunately i have to report that in 5.9.1 this is NOT fixed :)  

plasma behaves as follows: (starting with a blank new setup)

there is only one containment in  plasma-org.kde.plasma.desktop-appletsrc

[Containments][1]
activityId=86868fa6-a85a-4e74-a8d2-8abda1d6ae3e
formfactor=0
immutability=1
lastScreen=0
location=0
plugin=org.kde.desktopcontainment
wallpaperplugin=org.kde.image


>> Then i add an Applet - the applet part gets added to the config file to containment [1]



>> Then i attach a beamer - a new containment [21] is added to the config file:
(the beamer is placed right of the mainscreen with the maincontainment)




>> then i "clone" the two screens by using xrandr (or the kscreen configuration tool (it doesn't matter)) and the containment [21] covers containment [1]  -> all widgets are hidden.


hitting alt+tab (with no applications open) still makes the switch to the maincontainment

rebooting the system always shows the unconfigured new containment :-(

this is a real showstopper..


bug still there or did the patch miss 5.9.1 ?
Comment 18 Thomas Weissel 2017-03-02 16:12:49 UTC
@christoph feck

this bug is resolved in 5.9.2 so i would leave it closed!

thx