effects/private: Merge two state machines, fix ending animation, improve visuals in Overview
There are two cleanup commits, two cosmetic visuals (the last ones), and two fundamental things that fix bugs.
There's a lot of text in individual commit messages, so here's it in one place:
(these ones are purely a refactoring)
effects/Overview: Move delegate handlers to the bottom close to each other
effects/private: Encapsulate DND management, and clean up the store
Use methods with semantic naming instead of raw data manipulation, and make sure to perform clean up of DND data, so it won't haunt us back later e.g. when a window delegate is recreated not because of a drag of itself but due to a desktops rearrangement.
(these are actual fixes)
effects/private: Merge two state machines into one with substates
Having one state machine instead of two somehow simplifies the code and makes it less fragile.
The new property substate
, which replaces thumbSource.state
still
supports imperative assignments that are so important for Drag&Drop,
and still triggers state updates. However, now a substate may not
become an active state: that behavior didn't make sense in previous
iterations, and has led to a glitch where a window won't resize during
return-to-initial animation. The glitch happened because two state
transitions were starting almost-simultaneously (and by Murphy's law in
the worst possible order, of course), and both animations were playing,
but one animation was supposed to to a property that is managed by the
other. But since QtQuick animations cache their from/to values before
they start, the dependent transition essentially didn't animate at all.
[PATCHv2] effects/private: Fix crash when shutting down desktop grid and overview
Because of const/non-const issues, iterator got invalidated in the loop, which led to a crash.
Cases that trigger it: interaction with a thumbnail while the effect is returning to initial state and shuts down. For example, slightly dragging and releasing a thumbnail such that both TapHandler & DragHandler would react and play each their own transition (yes, it's another bug); or by pressing Escape key while dragging.
[PATCHv2] effects/private: Nuke an unnecessary loop
It seems we can compare pointers to QQuickWindow objects just fine, and any item that's on screen should have one.
(and now for some features)
effects/private: Encapsulate DND management, and clean up the store
Use methods with semantic naming instead of raw data manipulation, and make sure to perform clean up of DND data, so it won't haunt us back later e.g. when a window delegate is recreated not because of a drag of itself but due to a desktops rearrangement.