Changeset View
Changeset View
Standalone View
Standalone View
effects/projector/projector.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee> | ||||
6 | Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com> | ||||
7 | Copyright (C) 2017 Krzysztof Nowicki <krissn@op.pl> | ||||
8 | | ||||
9 | This program is free software; you can redistribute it and/or modify | ||||
10 | it under the terms of the GNU General Public License as published by | ||||
11 | the Free Software Foundation; either version 2 of the License, or | ||||
12 | (at your option) any later version. | ||||
13 | | ||||
14 | This program is distributed in the hope that it will be useful, | ||||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
17 | GNU General Public License for more details. | ||||
18 | | ||||
19 | You should have received a copy of the GNU General Public License | ||||
20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
21 | *********************************************************************/ | ||||
22 | | ||||
23 | #ifndef KWIN_PROJECTOR_H | ||||
24 | #define KWIN_PROJECTOR_H | ||||
25 | | ||||
26 | #include <QGenericMatrix> | ||||
27 | #include <kwineffects.h> | ||||
28 | | ||||
29 | namespace KWin | ||||
30 | { | ||||
31 | | ||||
32 | class GLTexture; | ||||
33 | | ||||
34 | /** | ||||
35 | * Transforms an output to correct for projector misalignment | ||||
36 | **/ | ||||
37 | class ProjectorEffect | ||||
38 | : public Effect | ||||
39 | { | ||||
40 | Q_OBJECT | ||||
41 | Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.ProjectorEffect") | ||||
42 | public: | ||||
43 | ProjectorEffect(); | ||||
44 | ~ProjectorEffect(); | ||||
45 | | ||||
46 | virtual void drawWindow(EffectWindow* w, int mask, QRegion region, | ||||
47 | WindowPaintData& data) Q_DECL_OVERRIDE; | ||||
48 | virtual void prePaintScreen(ScreenPrePaintData &data, int time) Q_DECL_OVERRIDE; | ||||
49 | virtual void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) Q_DECL_OVERRIDE; | ||||
50 | virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data) Q_DECL_OVERRIDE; | ||||
51 | virtual bool isActive() const Q_DECL_OVERRIDE; | ||||
52 | | ||||
53 | static bool supported(); | ||||
54 | | ||||
55 | public Q_SLOTS: | ||||
56 | bool setScreenTranslation(const QString &screen, const QList<double> &corners); | ||||
57 | | ||||
58 | private Q_SLOTS: | ||||
59 | void slotScreenGeometryChanged(const QSize &size); | ||||
60 | void slotMouseChanged(const QPoint& pos, const QPoint& old, | ||||
61 | Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, | ||||
62 | Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers); | ||||
63 | private: | ||||
64 | QPointF translatePoint(float x, float y, const QMatrix3x3 &mat/*const QRect &screenRect*/) const; | ||||
65 | static QMatrix3x3 calculateTransform(const QPolygonF &quad, const QRect &screenRect); | ||||
66 | void recreateTexture(); | ||||
67 | | ||||
68 | struct ScreenData { | ||||
69 | QString id; | ||||
70 | int number; | ||||
71 | QPolygonF quad; | ||||
72 | QMatrix3x3 transMatrix; | ||||
73 | QRect rect; | ||||
74 | }; | ||||
75 | | ||||
76 | QVector<ScreenData> m_screenData; | ||||
77 | QRegion m_transformedRegion; | ||||
78 | QScopedPointer<GLTexture> m_cursorTexture; | ||||
79 | QSize m_cursorSize; | ||||
80 | QPoint m_cursorHotSpot; | ||||
81 | QPoint m_cursorPos; | ||||
82 | bool m_cursorVisible; | ||||
83 | }; | ||||
84 | | ||||
85 | } // namespace | ||||
86 | | ||||
87 | #endif |