Containments that have no assigned screen keep -1 as the id of the
screen. For those, the previously defined asserts would fail not
allowing plasma shell to start in debug mode.
If screenForContainment() depends on the existence of the view instance,
while the corona is starting up, screen() will return -1 for a while,
changing the behavior depending where is called.
this patch makes screen() return a stable final value, even before any
view has been created.
this is (also) needed for correctly keeping track of what containments
are still loading, what finished.
REVIEW:120179
the screen related static methods are just as well served by being
class members: they aren't used elsewhere, were being passed the same
internal datamembers repeatedly, etc.
also move them below the constructor to where they generally make
more contextual sense.
this places the responsibility on the shell package and removes
the assumption that the alternatives UI is a dialog that is placed
alongside the applet. that, my friends, is a desktop form factor
assumption.
rather than implementing it as a (harder to read) recursive
function, simply start from the second-to-last item in the list and
march backwards until it hits the index being removed, moving the
panels and desktop forward as it goes.
previously it was starting from the index being removed, moving
the panels to the next screen, then processing the next screen
at which point all the panels on idx would now be on idx+1's screen
and they'd get pushed forward again. on a 4 screen system with
panels on each i bet that was fun to watch.
this should be both less buggy and easier to comprehend code.
The primaryOutput method in KScreen is not consistent with Output::isPrimary
and made plasma shell become a bit inconsistent too.
Loop through the outputs for now, until we've got a better solution.
BUG: 338109
CCBUG: 335710
Have separate code paths instead, otherwise we'd end up inserting the same
containments twice.
Also add an assert to make sure this doesn't happen anymore.
CCBUG:337928