The hack we used to have is not working anymore because they changed how
Qt works (And it was a hack after all).
On the other hand, on Qt 5.4 we can use the API I added for this purpose,
so listen to screen removed before the window is shuffled somewhere else
so we can cleanly remove the view.
Reviewed by DJ Edmundson
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.