Changeset View
Changeset View
Standalone View
Standalone View
effects/backgroundcontrast/contrast.h
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 47 | public: | |||
---|---|---|---|---|---|
60 | 60 | | |||
61 | bool provides(Feature feature) override; | 61 | bool provides(Feature feature) override; | ||
62 | 62 | | |||
63 | int requestedEffectChainPosition() const override { | 63 | int requestedEffectChainPosition() const override { | ||
64 | return 76; | 64 | return 76; | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | bool eventFilter(QObject *watched, QEvent *event) override; | 67 | bool eventFilter(QObject *watched, QEvent *event) override; | ||
68 | void paintScreen(int mask, QRegion region, KWin::ScreenPaintData & data) override; | ||||
68 | 69 | | |||
69 | public Q_SLOTS: | 70 | public Q_SLOTS: | ||
70 | void slotWindowAdded(KWin::EffectWindow *w); | 71 | void slotWindowAdded(KWin::EffectWindow *w); | ||
71 | void slotWindowDeleted(KWin::EffectWindow *w); | 72 | void slotWindowDeleted(KWin::EffectWindow *w); | ||
72 | void slotPropertyNotify(KWin::EffectWindow *w, long atom); | 73 | void slotPropertyNotify(KWin::EffectWindow *w, long atom); | ||
73 | void slotScreenGeometryChanged(); | 74 | void slotScreenGeometryChanged(); | ||
74 | 75 | | |||
75 | private: | 76 | private: | ||
76 | QRegion contrastRegion(const EffectWindow *w) const; | 77 | QRegion contrastRegion(const EffectWindow *w) const; | ||
77 | bool shouldContrast(const EffectWindow *w, int mask, const WindowPaintData &data) const; | 78 | bool shouldContrast(const EffectWindow *w, int mask, const WindowPaintData &data) const; | ||
78 | void updateContrastRegion(EffectWindow *w); | 79 | void updateContrastRegion(EffectWindow *w); | ||
79 | void doContrast(EffectWindow *w, const QRegion &shape, const QRect &screen, const float opacity, const QMatrix4x4 &screenProjection); | 80 | void doContrast(EffectWindow *w, const QRegion &shape, const QRect &screen, const float opacity, const QMatrix4x4 &screenProjection); | ||
80 | void uploadRegion(QVector2D *&map, const QRegion ®ion); | 81 | void uploadRegion(QVector2D *&map, const QRegion ®ion); | ||
81 | void uploadGeometry(GLVertexBuffer *vbo, const QRegion ®ion); | 82 | void uploadGeometry(GLVertexBuffer *vbo, const QRegion ®ion); | ||
82 | 83 | | |||
83 | private: | 84 | private: | ||
84 | ContrastShader *shader; | 85 | ContrastShader *shader; | ||
85 | long net_wm_contrast_region; | 86 | long net_wm_contrast_region; | ||
86 | QRegion m_paintedArea; // actually painted area which is greater than m_damagedArea | 87 | QRegion m_paintedArea; // actually painted area which is greater than m_damagedArea | ||
87 | QRegion m_currentContrast; // keeps track of the currently contrasted area of non-caching windows(from bottom to top) | 88 | QRegion m_currentContrast; // keeps track of the currently contrasted area of non-caching windows(from bottom to top) | ||
88 | QHash< const EffectWindow*, QMatrix4x4> m_colorMatrices; | 89 | QHash< const EffectWindow*, QMatrix4x4> m_colorMatrices; | ||
89 | QHash< const EffectWindow*, QMetaObject::Connection > m_contrastChangedConnections; // used only in Wayland to keep track of effect changed | 90 | QHash< const EffectWindow*, QMetaObject::Connection > m_contrastChangedConnections; // used only in Wayland to keep track of effect changed | ||
90 | KWayland::Server::ContrastManagerInterface *m_contrastManager = nullptr; | 91 | KWayland::Server::ContrastManagerInterface *m_contrastManager = nullptr; | ||
92 | int m_screenRotation = 0; | ||||
91 | }; | 93 | }; | ||
92 | 94 | | |||
93 | inline | 95 | inline | ||
94 | bool ContrastEffect::provides(Effect::Feature feature) | 96 | bool ContrastEffect::provides(Effect::Feature feature) | ||
95 | { | 97 | { | ||
96 | if (feature == Contrast) { | 98 | if (feature == Contrast) { | ||
97 | return true; | 99 | return true; | ||
98 | } | 100 | } | ||
99 | return KWin::Effect::provides(feature); | 101 | return KWin::Effect::provides(feature); | ||
100 | } | 102 | } | ||
101 | 103 | | |||
102 | 104 | | |||
103 | } // namespace KWin | 105 | } // namespace KWin | ||
104 | 106 | | |||
105 | #endif | 107 | #endif | ||
106 | 108 | |