not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / randr / randrscreen.h
blob53277a31caee233c6b69efcd4fbe3f8f093be7c9
1 /*
2 * Copyright (c) 2007 Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
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 published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (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 General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef __RANDRSCREEN_H__
20 #define __RANDRSCREEN_H__
22 #include "randr.h"
24 #include <QX11Info>
25 #include <QObject>
26 #include <QMap>
28 class QSize;
29 class QAction;
30 class KConfig;
32 class RandRScreen : public QObject
34 Q_OBJECT
36 public:
37 RandRScreen(int screenIndex);
38 ~RandRScreen();
40 int index() const;
42 XRRScreenResources* resources() const;
43 Window rootWindow() const;
45 QSize minSize() const;
46 QSize maxSize() const;
48 void loadSettings(bool notify = false);
50 void handleEvent(XRRScreenChangeNotifyEvent* event);
51 void handleRandREvent(XRRNotifyEvent* event);
53 CrtcMap crtcs() const;
54 RandRCrtc *crtc(RRCrtc id) const;
56 OutputMap outputs() const;
57 RandROutput *output(RROutput id) const;
59 ModeMap modes() const;
60 RandRMode mode(RRMode id) const;
62 bool adjustSize(const QRect &minimumSize = QRect(0,0,0,0));
63 bool setSize(const QSize &s);
65 /**
66 * Return the number of connected outputs
68 int connectedCount() const;
70 /**
71 * Return the number of active outputs
73 int activeCount() const;
75 bool outputsUnified() const;
76 void setOutputsUnified(bool unified);
78 int unifiedRotations() const;
79 SizeList unifiedSizes() const;
81 QRect rect() const;
83 bool applyProposed(bool confirm);
85 void load(KConfig &config);
86 void save(KConfig &config);
88 public slots:
89 void slotUnifyOutputs(bool unify);
90 void slotResizeUnified(QAction *action);
91 void slotRotateUnified(QAction *action);
93 void slotOutputChanged(RROutput id, int changes);
95 void save();
96 void load();
98 signals:
99 void configChanged();
101 protected slots:
102 void unifyOutputs();
104 private:
105 int m_index;
106 QSize m_minSize;
107 QSize m_maxSize;
108 QRect m_rect;
110 bool m_outputsUnified;
111 QRect m_unifiedRect;
112 int m_unifiedRotation;
114 int m_connectedCount;
115 int m_activeCount;
117 XRRScreenResources* m_resources;
119 CrtcMap m_crtcs;
120 OutputMap m_outputs;
121 ModeMap m_modes;
125 #endif