1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 2011 Thomas Lübking <thomas.luebking@web.de> 6 SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 7 8 SPDX-License-Identifier: GPL-2.0-or-later 9 */ 10 11 #ifndef ANIDATA_H 12 #define ANIDATA_H 13 14 #include "kwinanimationeffect.h" 15 16 #include <QEasingCurve> 17 18 namespace KWin { 19 20 /** 21 * Wraps effects->setActiveFullScreenEffect for the duration of it's lifespan 22 */ 23 class FullScreenEffectLock 24 { 25 public: 26 FullScreenEffectLock(Effect *effect); 27 ~FullScreenEffectLock(); 28 private: 29 Q_DISABLE_COPY(FullScreenEffectLock) 30 }; 31 typedef QSharedPointer<FullScreenEffectLock> FullScreenEffectLockPtr; 32 33 /** 34 * Keeps windows alive during animation after they got closed 35 */ 36 class KeepAliveLock 37 { 38 public: 39 KeepAliveLock(EffectWindow *w); 40 ~KeepAliveLock(); 41 42 private: 43 EffectWindow *m_window; 44 Q_DISABLE_COPY(KeepAliveLock) 45 }; 46 typedef QSharedPointer<KeepAliveLock> KeepAliveLockPtr; 47 48 /** 49 * References the previous window pixmap to prevent discarding. 50 */ 51 class PreviousWindowPixmapLock 52 { 53 public: 54 PreviousWindowPixmapLock(EffectWindow *w); 55 ~PreviousWindowPixmapLock(); 56 57 private: 58 EffectWindow *m_window; 59 Q_DISABLE_COPY(PreviousWindowPixmapLock) 60 }; 61 typedef QSharedPointer<PreviousWindowPixmapLock> PreviousWindowPixmapLockPtr; 62 63 class KWINEFFECTS_EXPORT AniData { 64 public: 65 AniData(); 66 AniData(AnimationEffect::Attribute a, int meta, const FPx2 &to, 67 int delay, const FPx2 &from, bool waitAtSource, 68 FullScreenEffectLockPtr =FullScreenEffectLockPtr(), 69 bool keepAlive = true, PreviousWindowPixmapLockPtr previousWindowPixmapLock = {}); 70 71 bool isActive() const; 72 isOneDimensional()73 inline bool isOneDimensional() const { 74 return from[0] == from[1] && to[0] == to[1]; 75 } 76 77 quint64 id{0}; 78 QString debugInfo() const; 79 AnimationEffect::Attribute attribute; 80 int customCurve; 81 FPx2 from, to; 82 TimeLine timeLine; 83 uint meta; 84 qint64 startTime; 85 QSharedPointer<FullScreenEffectLock> fullScreenEffectLock; 86 bool waitAtSource; 87 bool keepAlive; 88 KeepAliveLockPtr keepAliveLock; 89 PreviousWindowPixmapLockPtr previousWindowPixmapLock; 90 AnimationEffect::TerminationFlags terminationFlags; 91 std::chrono::milliseconds lastPresentTime; 92 }; 93 94 } // namespace 95 96 QDebug operator<<(QDebug dbg, const KWin::AniData &a); 97 98 #endif // ANIDATA_H 99