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__
29
#include "randrmode.h"
32
/** Class representing an RROutput identifier. This class is used
33
* to control a particular output's configuration (i.e., the mode or
34
* refresh rate of a DVI-I port, or the resolution of a VGA port). */
35
class RandROutput : public QObject
40
RandROutput(RandRScreen *parent, RROutput id);
43
/** Returns the internal RANDR identifier for a particular output. */
46
/** Return the screen that this output belongs to. */
47
RandRScreen *screen() const;
49
void loadSettings(bool notify = false);
51
/** Handle an event from RANDR signifying a change in this output's
53
void handleEvent(XRROutputChangeNotifyEvent *event);
54
void handlePropertyEvent(XRROutputPropertyNotifyEvent *event);
56
/** The name of this output, as returned by the X device driver.
57
* Examples may be VGA, TMDS, DVI-I_2/digital, etc. Note:
58
* this is usually NOT the name returned in the EDID of your
62
/** Return the icon name according to the device type. */
65
/** List possible CRT controllers for this output. */
66
CrtcList possibleCrtcs() const;
68
/** Returns the current CRTC for this output. */
69
RandRCrtc *crtc() const;
71
/** Returns a list of all RRModes supported by this output. */
72
ModeList modes() const;
74
/** Returns the current mode for this output. */
75
RandRMode mode() const;
77
/** Returns the preferred mode for this output. */
78
RandRMode preferredMode(void) const;
80
/** The list of supported sizes */
81
SizeList sizes() const;
84
/** The list of refresh rates for the given size.
85
* If no size is specified, it will use the current size */
86
RateList refreshRates(const QSize &s = QSize()) const;
88
/** The current refresh rate. */
89
float refreshRate() const;
91
/** Return all possible rotations for all CRTCs this output can be connected
93
int rotations() const;
95
/** Returns the curent rotation of the CRTC this output is currently
99
/** Determines whether this output is connected to a display device.
100
* It is not necessarily active. */
101
bool isConnected() const;
103
/** Determines whether this output is currently driving a display
105
bool isActive() const;
107
bool applyProposed(int changes = 0xffffff);
108
void proposeOriginal();
110
// proposal functions
111
void proposeRefreshRate(float rate);
112
void proposeRect(const QRect &r);
113
void proposeRotation(int rotation);
120
void slotCrtcChanged(RRCrtc c, int changes);
123
/** This signal is emitted when any relevant change
124
* occurs in an output (mode, CRTC, resolution,
125
* connection, etc.) */
126
void outputChanged(RROutput o, int changes);
129
/** Query Xrandr for information about this output, and set
130
* up this instance accordingly. */
131
bool queryOutputInfo(void);
133
/** Find the first CRTC that is not controlling any
134
* display devices. */
135
RandRCrtc *findEmptyCrtc(void);
136
bool tryCrtc(RandRCrtc *crtc, int changes);
138
/** Set the current CRT controller for this output.
139
* The CRTC should never be set directly; it should be added through
140
* this function to properly manage signals related to this output. */
141
bool setCrtc(RandRCrtc *crtc, bool applyNow = true);
145
XRROutputInfo* m_info;
149
CrtcList m_possibleCrtcs;
151
RandRScreen *m_screen;
154
//proposed stuff (mostly to read from the configuration)
155
QRect m_proposedRect;
156
int m_proposedRotation;
157
float m_proposedRate;
159
QRect m_originalRect;
160
int m_originalRotation;
161
float m_originalRate;
164
RandRMode m_preferredMode;