KWin
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
thumbnailaside.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
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11/*
12
13 Testing of painting a window more than once.
14
15*/
16
17#pragma once
18
19#include "effect/effect.h"
20
21#include <QHash>
22
23namespace KWin
24{
25
27 : public Effect
28{
29 Q_OBJECT
30 Q_PROPERTY(int maxWidth READ configuredMaxWidth)
31 Q_PROPERTY(int spacing READ configuredSpacing)
32 Q_PROPERTY(qreal opacity READ configuredOpacity)
33 Q_PROPERTY(int screen READ configuredScreen)
34public:
36 void reconfigure(ReconfigureFlags) override;
37 void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
38 void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
39
40 // for properties
42 {
43 return maxwidth;
44 }
46 {
47 return spacing;
48 }
49 qreal configuredOpacity() const
50 {
51 return opacity;
52 }
53 int configuredScreen() const
54 {
55 return screen;
56 }
57 bool isActive() const override;
58
59private Q_SLOTS:
60 void toggleCurrentThumbnail();
61 void slotWindowAdded(KWin::EffectWindow *w);
62 void slotWindowClosed(KWin::EffectWindow *w);
63 void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRectF &old);
64 void slotWindowDamaged(KWin::EffectWindow *w);
65 void repaintAll();
66
67private:
68 void addThumbnail(EffectWindow *w);
69 void removeThumbnail(EffectWindow *w);
70 void arrange();
71 struct Data
72 {
73 EffectWindow *window; // the same like the key in the hash (makes code simpler)
74 int index;
75 QRect rect;
76 };
77 QHash<EffectWindow *, Data> windows;
78 int maxwidth;
79 int spacing;
80 double opacity;
81 int screen;
82 QRegion painted;
83};
84
85} // namespace
Base class for all KWin effects.
Definition effect.h:535
Representation of a window used by/for Effect classes.
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override
bool isActive() const override
void reconfigure(ReconfigureFlags) override
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override