Changeset View
Changeset View
Standalone View
Standalone View
effects/scale/scale.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
6 | | ||||
7 | This program is free software; you can redistribute it and/or modify | ||||
8 | it under the terms of the GNU General Public License as published by | ||||
9 | the Free Software Foundation; either version 2 of the License, or | ||||
10 | (at your option) any later version. | ||||
11 | | ||||
12 | This program is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | GNU General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU General Public License | ||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | | ||||
21 | #ifndef KWIN_SCALE_H | ||||
22 | #define KWIN_SCALE_H | ||||
23 | | ||||
24 | #include <kwineffects.h> | ||||
25 | | ||||
26 | #include <QTimeLine> | ||||
27 | | ||||
28 | namespace KWin | ||||
29 | { | ||||
30 | | ||||
31 | class ScaleEffect : public Effect | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | | ||||
35 | public: | ||||
36 | ScaleEffect(); | ||||
37 | ~ScaleEffect() override; | ||||
38 | | ||||
39 | void reconfigure(ReconfigureFlags flags) override; | ||||
40 | | ||||
41 | void prePaintScreen(ScreenPrePaintData &data, int time) override; | ||||
42 | void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override; | ||||
43 | void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override; | ||||
44 | void postPaintScreen() override; | ||||
45 | | ||||
46 | bool isActive() const override; | ||||
47 | int requestedEffectChainPosition() const override; | ||||
48 | | ||||
49 | static bool supported(); | ||||
50 | | ||||
51 | private Q_SLOTS: | ||||
52 | void windowAdded(EffectWindow *w); | ||||
53 | void windowClosed(EffectWindow *w); | ||||
54 | void windowDeleted(EffectWindow *w); | ||||
55 | void windowDataChanged(EffectWindow *w, int role); | ||||
56 | | ||||
57 | private: | ||||
58 | bool isScaleWindow(EffectWindow *w) const; | ||||
59 | | ||||
60 | int m_duration; | ||||
61 | QHash<EffectWindow*, QTimeLine*> m_animations; | ||||
62 | | ||||
63 | struct ScaleParams { | ||||
64 | struct { | ||||
65 | qreal from; | ||||
66 | qreal to; | ||||
67 | } scale, opacity; | ||||
68 | }; | ||||
69 | | ||||
70 | ScaleParams m_inParams; | ||||
71 | ScaleParams m_outParams; | ||||
72 | }; | ||||
73 | | ||||
74 | inline int ScaleEffect::requestedEffectChainPosition() const | ||||
75 | { | ||||
76 | return 50; | ||||
77 | } | ||||
78 | | ||||
79 | } // namespace KWin | ||||
80 | | ||||
81 | #endif |