File indexing completed on 2024-05-19 16:34:29

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2011 Thomas Lübking <thomas.luebking@web.de>
0006     SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #pragma once
0012 
0013 #include "kwinanimationeffect.h"
0014 
0015 #include <QEasingCurve>
0016 
0017 namespace KWin
0018 {
0019 
0020 /**
0021  * Wraps effects->setActiveFullScreenEffect for the duration of it's lifespan
0022  */
0023 class FullScreenEffectLock
0024 {
0025 public:
0026     FullScreenEffectLock(Effect *effect);
0027     ~FullScreenEffectLock();
0028 
0029 private:
0030     Q_DISABLE_COPY(FullScreenEffectLock)
0031 };
0032 typedef QSharedPointer<FullScreenEffectLock> FullScreenEffectLockPtr;
0033 
0034 /**
0035  * References the previous window pixmap to prevent discarding.
0036  */
0037 class PreviousWindowPixmapLock
0038 {
0039 public:
0040     PreviousWindowPixmapLock(EffectWindow *w);
0041     ~PreviousWindowPixmapLock();
0042 
0043 private:
0044     EffectWindow *m_window;
0045     Q_DISABLE_COPY(PreviousWindowPixmapLock)
0046 };
0047 typedef QSharedPointer<PreviousWindowPixmapLock> PreviousWindowPixmapLockPtr;
0048 
0049 class KWINEFFECTS_EXPORT AniData
0050 {
0051 public:
0052     AniData();
0053     AniData(AnimationEffect::Attribute a, int meta, const FPx2 &to,
0054             int delay, const FPx2 &from, bool waitAtSource,
0055             FullScreenEffectLockPtr = FullScreenEffectLockPtr(),
0056             bool keepAlive = true, PreviousWindowPixmapLockPtr previousWindowPixmapLock = {}, GLShader *shader = nullptr);
0057 
0058     bool isActive() const;
0059 
0060     inline bool isOneDimensional() const
0061     {
0062         return from[0] == from[1] && to[0] == to[1];
0063     }
0064 
0065     quint64 id{0};
0066     QString debugInfo() const;
0067     AnimationEffect::Attribute attribute;
0068     int customCurve;
0069     FPx2 from, to;
0070     TimeLine timeLine;
0071     uint meta;
0072     qint64 frozenTime;
0073     qint64 startTime;
0074     QSharedPointer<FullScreenEffectLock> fullScreenEffectLock;
0075     bool waitAtSource;
0076     bool keepAlive;
0077     EffectWindowDeletedRef deletedRef;
0078     EffectWindowVisibleRef visibleRef;
0079     PreviousWindowPixmapLockPtr previousWindowPixmapLock;
0080     AnimationEffect::TerminationFlags terminationFlags;
0081     GLShader *shader{nullptr};
0082 };
0083 
0084 } // namespace
0085 
0086 QDebug operator<<(QDebug dbg, const KWin::AniData &a);