Changeset View
Changeset View
Standalone View
Standalone View
effects/slide/slide.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org> | 5 | Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org> | ||
6 | Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com> | 6 | Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com> | ||
7 | Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
7 | 8 | | |||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | 11 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | 12 | (at your option) any later version. | ||
12 | 13 | | |||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. | ||
17 | 18 | | |||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 21 | *********************************************************************/ | ||
21 | 22 | | |||
22 | #ifndef KWIN_SLIDE_H | 23 | #ifndef KWIN_SLIDE_H | ||
23 | #define KWIN_SLIDE_H | 24 | #define KWIN_SLIDE_H | ||
24 | 25 | | |||
26 | // KDE | ||||
25 | #include <kwineffects.h> | 27 | #include <kwineffects.h> | ||
28 | | ||||
29 | // Qt | ||||
26 | #include <QObject> | 30 | #include <QObject> | ||
27 | #include <QTimeLine> | 31 | #include <QTimeLine> | ||
28 | 32 | | |||
29 | namespace KWin | 33 | namespace KWin | ||
30 | { | 34 | { | ||
31 | 35 | | |||
32 | class SlideEffect | 36 | class SlideEffect : public Effect | ||
33 | : public Effect | | |||
34 | { | 37 | { | ||
35 | Q_OBJECT | 38 | Q_OBJECT | ||
36 | public: | 39 | public: | ||
37 | SlideEffect(); | 40 | SlideEffect(); | ||
38 | virtual void reconfigure(ReconfigureFlags); | 41 | | ||
39 | virtual void prePaintScreen(ScreenPrePaintData& data, int time); | 42 | void reconfigure(ReconfigureFlags) override; | ||
40 | virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data); | 43 | | ||
41 | virtual void postPaintScreen(); | 44 | void prePaintScreen(ScreenPrePaintData& data, int time) override; | ||
42 | virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); | 45 | void paintScreen(int mask, QRegion region, ScreenPaintData& data) override; | ||
43 | virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); | 46 | void postPaintScreen() override; | ||
44 | virtual bool isActive() const; | 47 | | ||
48 | void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override; | ||||
49 | void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override; | ||||
50 | | ||||
51 | bool isActive() const override { | ||||
52 | return m_active; | ||||
53 | } | ||||
45 | 54 | | |||
46 | int requestedEffectChainPosition() const override { | 55 | int requestedEffectChainPosition() const override { | ||
47 | return 50; | 56 | return 50; | ||
48 | } | 57 | } | ||
49 | 58 | | |||
50 | static bool supported(); | 59 | static bool supported(); | ||
51 | 60 | | |||
52 | private Q_SLOTS: | 61 | private Q_SLOTS: | ||
53 | void slotDesktopChanged(int old, int current, KWin::EffectWindow* with); | 62 | void desktopChanged(int old, int current, EffectWindow* with); | ||
54 | | ||||
55 | private: | | |||
56 | void windowAdded(EffectWindow* w); | 63 | void windowAdded(EffectWindow* w); | ||
57 | void windowDeleted(EffectWindow* w); | 64 | void windowDeleted(EffectWindow* w); | ||
58 | bool shouldForceBackgroundContrast(const EffectWindow* w) const; | 65 | | ||
59 | QList< EffectWindow* > m_backgroundContrastForcedBefore; | 66 | void numberDesktopsChanged(uint old); | ||
60 | QRect desktopRect(int desktop) const; | 67 | void numberScreensChanged(); | ||
61 | QTimeLine mTimeLine; | 68 | | ||
62 | int painting_desktop; | 69 | private: | ||
63 | bool slide; | 70 | QPoint desktopCoords(int id) const; | ||
64 | QPoint slide_start_pos; | 71 | QRect desktopGeometry(int id) const; | ||
65 | bool slide_painting_sticky; | 72 | int workspaceWidth() const; | ||
66 | bool slide_painting_keep_above; | 73 | int workspaceHeight() const; | ||
67 | QPoint slide_painting_diff; | 74 | | ||
75 | bool isTranslated(const EffectWindow* w) const; | ||||
76 | bool isPainted(const EffectWindow* w) const; | ||||
77 | | ||||
78 | void start(int old, int current, EffectWindow* movingWindow = nullptr); | ||||
79 | void stop(); | ||||
80 | | ||||
81 | private: | ||||
82 | int m_hGap; | ||||
83 | int m_vGap; | ||||
84 | bool m_slideDocks; | ||||
85 | | ||||
86 | bool m_active = false; | ||||
87 | QTimeLine m_timeline; | ||||
88 | QPoint m_startPos; | ||||
89 | QPoint m_diff; | ||||
68 | EffectWindow* m_movingWindow = nullptr; | 90 | EffectWindow* m_movingWindow = nullptr; | ||
69 | 91 | | |||
92 | struct { | ||||
93 | int desktop; | ||||
94 | bool lastPass; | ||||
95 | QPoint translation; | ||||
96 | | ||||
97 | EffectWindowList fullscreenWindows; | ||||
98 | } m_paintCtx; | ||||
99 | | ||||
100 | QList<EffectWindow*> m_backgroundContrastForcedBefore; | ||||
70 | }; | 101 | }; | ||
71 | 102 | | |||
72 | } // namespace | 103 | } // namespace | ||
73 | 104 | | |||
74 | #endif | 105 | #endif |