KWin
Loading...
Searching...
No Matches
diminactive.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2007 Lubos Lunak <l.lunak@kde.org>
6 SPDX-FileCopyrightText: 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
7 SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10*/
11
12#pragma once
13
14// kwineffects
15#include "effect/effect.h"
16#include "effect/timeline.h"
17
18namespace KWin
19{
20
21class EffectWindowGroup;
22
24{
25 Q_OBJECT
26 Q_PROPERTY(int dimStrength READ dimStrength)
27 Q_PROPERTY(bool dimPanels READ dimPanels)
28 Q_PROPERTY(bool dimDesktop READ dimDesktop)
29 Q_PROPERTY(bool dimKeepAbove READ dimKeepAbove)
30 Q_PROPERTY(bool dimByGroup READ dimByGroup)
31 Q_PROPERTY(bool dimFullScreen READ dimFullScreen)
32
33public:
35 ~DimInactiveEffect() override;
36
37 void reconfigure(ReconfigureFlags flags) override;
38
39 void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
40 void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
41 void postPaintScreen() override;
42
43 int requestedEffectChainPosition() const override;
44 bool isActive() const override;
45
46 int dimStrength() const;
47 bool dimPanels() const;
48 bool dimDesktop() const;
49 bool dimKeepAbove() const;
50 bool dimByGroup() const;
51 bool dimFullScreen() const;
52
53private Q_SLOTS:
54 void windowActivated(EffectWindow *w);
55 void windowAdded(EffectWindow *w);
56 void windowClosed(EffectWindow *w);
57 void windowDeleted(EffectWindow *w);
58 void activeFullScreenEffectChanged();
59
60 void updateActiveWindow(EffectWindow *w);
61
63 void dimWindow(WindowPaintData &data, qreal strength);
64 bool canDimWindow(const EffectWindow *w) const;
65 void scheduleInTransition(EffectWindow *w);
66 void scheduleGroupInTransition(EffectWindow *w);
67 void scheduleOutTransition(EffectWindow *w);
68 void scheduleGroupOutTransition(EffectWindow *w);
69 void scheduleRepaint(EffectWindow *w);
70
72 qreal m_dimStrength;
73 bool m_dimPanels;
74 bool m_dimDesktop;
75 bool m_dimKeepAbove;
76 bool m_dimByGroup;
77 bool m_dimFullScreen;
78
79 EffectWindow *m_activeWindow = nullptr;
80 const EffectWindowGroup *m_activeWindowGroup;
81 QHash<EffectWindow *, TimeLine> m_transitions;
82 QHash<EffectWindow *, qreal> m_forceDim;
83
84 struct
85 {
86 bool active = false;
88 } m_fullScreenTransition;
89};
90
92{
93 return 50;
94}
95
96inline bool DimInactiveEffect::isActive() const
97{
98 return true;
99}
100
102{
103 return qRound(m_dimStrength * 100.0);
104}
105
107{
108 return m_dimPanels;
109}
110
112{
113 return m_dimDesktop;
114}
115
117{
118 return m_dimKeepAbove;
119}
120
122{
123 return m_dimByGroup;
124}
125
127{
128 return m_dimFullScreen;
129}
130
131} // namespace KWin
int requestedEffectChainPosition() const override
Definition diminactive.h:91
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override
void reconfigure(ReconfigureFlags flags) override
void postPaintScreen() override
bool isActive() const override
Definition diminactive.h:96
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override
Base class for all KWin effects.
Definition effect.h:535
Representation of a window used by/for Effect classes.
#define private