Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 653cea5f authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects/slidingpopups] Overhaul the animations data struct

The existing Data struct has some serious problems:

(a) naming is not intuitive, SlideInterface uses more cleaner terminology
    so let's use that (and because Wayland is the future);

(b) fadeInTime and fadeOutTime should be slideInDuration and slideOutDuration
    respectively. The Sliding popups effect doesn't fade windows, it slides

(c) mWindowsData should be m_animationsData because other parts of this
    effect refer to it as "anim data"(e.g. setupAnimData).

This effect uses its own Location enum class instead of KWayland::
Server::SlideInterface::Location because it would be better to not
depend on platform specific data structures.

As a side effect, this change also fixes QHash abuse. The Sliding popups
effect is still hashing windows twice in prePaintWindow and paintWindow.
But I think that's acceptable because usually there would be only one
active sliding window.

CCBUG: 331118

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision:
parent af34144f
This diff is collapsed.
......@@ -31,8 +31,8 @@ class SlidingPopupsEffect
: public Effect
Q_PROPERTY(int fadeInTime READ fadeInTime)
Q_PROPERTY(int fadeOutTime READ fadeOutTime)
Q_PROPERTY(int slideInDuration READ slideInDuration)
Q_PROPERTY(int slideOutDuration READ slideOutDuration)
......@@ -51,13 +51,9 @@ public:
// TODO react also on virtual desktop changes
// for properties
int fadeInTime() const {
return mFadeInTime.count();
int fadeOutTime() const {
return mFadeOutTime.count();
int slideInDuration() const;
int slideOutDuration() const;
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow *c);
void slotWindowDeleted(KWin::EffectWindow *w);
......@@ -70,26 +66,11 @@ public Q_SLOTS:
void setupAnimData(EffectWindow *w);
enum Position {
West = 0,
North = 1,
East = 2,
South = 3
struct Data {
int start; //point in screen coordinates where the window starts
//to animate, from decides if this point is an x or an y
Position from;
std::chrono::milliseconds fadeInDuration;
std::chrono::milliseconds fadeOutDuration;
int slideLength;
long mAtom;
QHash< const EffectWindow*, Data > mWindowsData;
int mSlideLength;
std::chrono::milliseconds mFadeInTime;
std::chrono::milliseconds mFadeOutTime;
std::chrono::milliseconds m_slideInDuration;
std::chrono::milliseconds m_slideOutDuration;
enum class AnimationKind {
......@@ -101,8 +82,34 @@ private:
TimeLine timeLine;
QHash<const EffectWindow*, Animation> m_animations;
enum class Location {
struct AnimationData {
int offset;
Location location;
std::chrono::milliseconds slideInDuration;
std::chrono::milliseconds slideOutDuration;
int slideLength;
QHash<const EffectWindow*, AnimationData> m_animationsData;
inline int SlidingPopupsEffect::slideInDuration() const
return m_slideInDuration.count();
inline int SlidingPopupsEffect::slideOutDuration() const
return m_slideOutDuration.count();
} // namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment