1 /*
2     KWin - the KDE window manager
3     This file is part of the KDE project.
4 
5     SPDX-FileCopyrightText: 2007 Rivo Laks <rivolaks@hot.ee>
6     SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
7 
8     SPDX-License-Identifier: GPL-2.0-or-later
9 */
10 
11 #ifndef KWIN_INVERT_H
12 #define KWIN_INVERT_H
13 
14 #include <kwineffects.h>
15 
16 namespace KWin
17 {
18 
19 class GLShader;
20 
21 /**
22  * Inverts desktop's colors
23  */
24 class InvertEffect
25     : public Effect
26 {
27     Q_OBJECT
28 public:
29     InvertEffect();
30     ~InvertEffect() override;
31 
32     void drawWindow(EffectWindow* w, int mask, const QRegion &region, WindowPaintData& data) override;
33     void paintEffectFrame(KWin::EffectFrame* frame, const QRegion &region, double opacity, double frameOpacity) override;
34     bool isActive() const override;
35     bool provides(Feature) override;
36 
37     int requestedEffectChainPosition() const override;
38 
39     static bool supported();
40 
41 public Q_SLOTS:
42     void toggleScreenInversion();
43     void toggleWindow();
44     void slotWindowClosed(KWin::EffectWindow *w);
45 
46 protected:
47     bool loadData();
48 
49 private:
50     bool m_inited;
51     bool m_valid;
52     GLShader* m_shader;
53     bool m_allWindows;
54     QList<EffectWindow*> m_windows;
55 };
56 
requestedEffectChainPosition()57 inline int InvertEffect::requestedEffectChainPosition() const
58 {
59     return 99;
60 }
61 
62 } // namespace
63 
64 #endif
65