2
* Copyright (c) 2007 Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
3
* Copyright (c) 2007, 2008 Harry Bock <hbock@providence.edu>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef __RANDROUTPUT_H__
21
#define __RANDROUTPUT_H__
28
#include "randrmode.h"
33
/** Class representing an RROutput identifier. This class is used
34
* to control a particular output's configuration (i.e., the mode or
35
* refresh rate of a DVI-I port, or the resolution of a VGA port). */
36
class RandROutput : public QObject
41
RandROutput(RandRScreen *parent, RROutput id);
44
/** Returns the internal RANDR identifier for a particular output. */
47
/** Return the screen that this output belongs to. */
48
RandRScreen *screen() const;
50
void loadSettings(bool notify = false);
52
/** Handle an event from RANDR signifying a change in this output's
54
void handleEvent(XRROutputChangeNotifyEvent *event);
55
void handlePropertyEvent(XRROutputPropertyNotifyEvent *event);
57
/** The name of this output, as returned by the X device driver.
58
* Examples may be VGA, TMDS, DVI-I_2/digital, etc. Note:
59
* this is usually NOT the name returned in the EDID of your
63
/** Return the icon name according to the device type. */
66
/** List possible CRT controllers for this output. */
67
CrtcList possibleCrtcs() const;
69
/** Returns the current CRTC for this output. */
70
RandRCrtc *crtc() const;
72
void disconnectFromCrtc();
74
/** Returns a list of all RRModes supported by this output. */
75
ModeList modes() const;
77
/** Returns the current mode for this output. */
78
RandRMode mode() const;
80
/** Returns the preferred mode for this output,
81
* or an invalid mode if no preferred mode is known. */
82
RandRMode preferredMode() const;
84
/** The list of supported sizes */
85
SizeList sizes() const;
88
/** The list of refresh rates for the given size.
89
* If no size is specified, it will use the current size */
90
RateList refreshRates(const QSize &s = QSize()) const;
92
/** The current refresh rate. */
93
float refreshRate() const;
95
/** Return all possible rotations for all CRTCs this output can be connected
97
int rotations() const;
99
/** Returns the curent rotation of the CRTC this output is currently
101
int rotation() const;
103
/** Determines whether this output is connected to a display device.
104
* It is not necessarily active. */
105
bool isConnected() const;
107
/** Determines whether this output is currently driving a display
109
bool isActive() const;
111
bool applyProposed(int changes = 0xffffff, bool confirm = false);
112
void proposeOriginal();
114
// proposal functions
115
void proposeRefreshRate(float rate);
116
void proposeRect(const QRect &r);
117
void proposeRotation(int rotation);
119
void load(KConfig &config);
120
void save(KConfig &config);
121
QStringList startupCommands() const;
124
void slotChangeSize(QAction *action);
125
void slotChangeRotation(QAction *action);
126
void slotChangeRefreshRate(QAction *action);
129
void slotSetAsPrimary(bool primary);
132
void slotCrtcChanged(RRCrtc c, int changes);
135
/** This signal is emitted when any relevant change
136
* occurs in an output (mode, CRTC, resolution,
137
* connection, etc.) */
138
void outputChanged(RROutput o, int changes);
141
/** Query Xrandr for information about this output, and set
142
* up this instance accordingly. */
143
void queryOutputInfo(void);
145
/** Find the first CRTC that is not controlling any
146
* display devices. */
147
RandRCrtc *findEmptyCrtc(void);
148
bool tryCrtc(RandRCrtc *crtc, int changes);
150
/** Set the current CRT controller for this output.
151
* The CRTC should never be set directly; it should be added through
152
* this function to properly manage signals related to this output. */
153
bool setCrtc(RandRCrtc *crtc, bool applyNow = true);
157
XRROutputInfo* m_info;
161
CrtcList m_possibleCrtcs;
163
RandRScreen *m_screen;
166
//proposed stuff (mostly to read from the configuration)
167
QRect m_proposedRect;
168
int m_proposedRotation;
169
float m_proposedRate;
171
QRect m_originalRect;
172
int m_originalRotation;
173
float m_originalRate;
176
RandRMode m_preferredMode;
182
// vim:noet:sts=8:sw=8: