2
* Copyright 2008 Aike J Sommer <dev@aikesommer.name>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2,
7
* or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef KEPHAL_SCREENS_H
22
#define KEPHAL_SCREENS_H
27
#include "kephal_export.h"
35
* A Screen is the area that is significant for
36
* displaying windows. or panels.
37
* Every activated Output belongs to exactly one
38
* Screen and is completely contained within that
39
* Screen. No two Screens overlap each other.
42
* 1 Output -> 1 Screen
43
* 2 Non-overlapping Outputs -> 2 Screen
44
* 2 Overlapping Outputs -> 1 Screen
46
class KEPHAL_EXPORT Screen : public QObject {
49
Screen(QObject * parent = 0);
52
* Returns the id of this Screen. The id
53
* is part of the Configuration and will
54
* be the same whenever the same Outputs
55
* are used with the same Configuration.
60
* The actual size of the screen in pixels.
61
* This is the smallest area possible, so
62
* that all Outputs are completely
65
virtual QSize size() = 0;
68
* The actual position on the framebuffer
71
virtual QPoint position() = 0;
74
* Returns whether this Screen is to be
75
* considered in privacy-mode.
76
* In this mode no content should be
77
* displayed on that screen unless the
80
virtual bool isPrivacyMode() = 0;
83
* Sets the state of the privacy-mode.
85
virtual void setPrivacyMode(bool b) = 0;
88
* Return a list of Outputs that are
89
* currently part of this Screen.
91
virtual QList<Output *> outputs() = 0;
94
* Returns whether this screen is the
95
* current primary screen.
96
* This is just a convenience method,
97
* since the real value is determined
98
* by the configuration used.
100
bool isPrimary() const;
103
* Make this Screen the primary one.
104
* This just calls the appropriate
105
* method in the Configuration.
110
* Returns the position and size of the
112
* This is just a convenience method.
120
* Screens is the entrance-point for all Screen-
121
* related operations.
122
* Use: Screens::self() for the currently
125
class KEPHAL_EXPORT Screens : public QObject {
129
* Returns the currently active instance.
131
static Screens * self();
133
Screens(QObject * parent);
137
* Returns the list of all current
139
* Every Screen has at least one Output
140
* and a non-zero size.
142
virtual QList<Screen *> screens() = 0;
145
* Find a Screen by its id.
147
virtual Screen * screen(int id);
150
* Returns the current primary Screen.
152
Screen * primaryScreen();
156
* This signal is emitted when a new
157
* Screen appears, due to an Output
158
* being activated or the Configuration
161
// QDW::screenCountChanged
162
void screenAdded(Kephal::Screen * s);
165
* This signal is emitted when a
166
* Screen disappears, due to an Output
167
* being deactivated or the
168
* Configuration being changed.
170
// QDW::screenCountChanged
171
void screenRemoved(int id);
174
* This signal is emitted when the size
175
* of the Screen changes.
178
// TODO: move to Screen and replace with no args version
179
void screenResized(Kephal::Screen * s, QSize oldSize, QSize newSize);
182
* This signal is emitted when the
183
* position of the Screen changes.
185
// QDW::resized emitted when position changes too - but not documented.
186
// TODO: move to Screen and replace with no args version
187
void screenMoved(Kephal::Screen * s, QPoint oldPosition, QPoint newPosition);
190
static Screens * s_instance;
194
* Defines a handful help methods for common tasks
196
class KEPHAL_EXPORT ScreenUtils {
198
/** Returns the number of screens. */
200
static int numScreens();
202
/** Returns the geometry of the given screen */
204
static QRect screenGeometry(int id);
206
/** Returns the size of the given screen */
207
// SYNTACTIC SUGAR around QDW
208
static QSize screenSize(int id);
210
/** Returns the geometry of the whole desktop */
211
// SYNTACTIC SUGAR around QApplication::desktop()->geometry()
212
static QRect desktopGeometry();
214
/** Returns the id of the screen that contains the given point */
215
// SYNTACTIC SUGAR around QDW::screenNumber()
216
static int screenId(QPoint p);
218
/** Returns the id of the primary screen */
219
// SYNTACTIC SUGAR around QDW::primaryScreen
220
static int primaryScreenId();
223
static int distance(const QRect & r, const QPoint & p);
229
#endif // KEPHAL_SCREENS_H