-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrosshair.h
127 lines (101 loc) · 3.13 KB
/
crosshair.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Lubos Lunak <[email protected]>
Copyright (C) 2013 Pawel Bartkiewicz <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_CROSSHAIR_H
#define KWIN_CROSSHAIR_H
#include <kwineffects.h>
#include <kwinglutils.h>
namespace KWin
{
class CrosshairEffect
: public Effect
{
Q_OBJECT
public:
CrosshairEffect();
~CrosshairEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual bool isActive() const;
static bool supported();
private slots:
void toggle();
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
void resetOffset();
void saveOffset();
void slotScreenGeometryChanged(const QSize& size);
void slotWindowActivated(KWin::EffectWindow* w);
void slotWindowGeometryShapeChanged(KWin::EffectWindow* w, const QRect& old);
void slotWindowFinishUserMovedResized(KWin::EffectWindow* w);
private:
enum Position
{
SCREEN_CENTRE = 0,
WINDOW_CENTRE = 1, /* Single window only */
CURRENT_WINDOW_CENTRE = 2 /* Always follow window focus */
};
enum Shape
{
IMAGE = 0,
CROSS = 1,
HOLLOW_CROSS = 2,
X = 3,
HOLLOW_X = 4,
SQUARE = 5,
DIAMOND = 6
};
enum BlendMode
{
NONE = 0,
OPAQUE = 1,
TRANSPARENT = 2,
BLACK_BG = 3,
INVERT = 4,
INVERT_ON_BLACK_BG = 5,
INVERT_WITH_ALPHA = 6,
DARKEN = 7,
LIGHTEN = 8,
MULTIPLY = 9
};
void createCrosshair(QPointF &pos, QVector<float> &v);
QPointF getScreenCentre();
QPointF getWindowCentre(KWin::EffectWindow* w);
bool isEnabledForScreen();
bool isEnabledForWindow(KWin::EffectWindow* w);
void updateOffset();
QVector<float> verts;
bool enabled;
int size;
float width;
float alpha;
QColor color;
Shape shape;
BlendMode blend;
Position position;
bool roundPosition;
int offsetX;
int offsetY;
QString imagePath;
GLTexture* texture;
QPointF currentPosition;
QRect currentPositionRect;
KWin::EffectWindow *lastWindow;
};
} // namespace
#endif