• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • krandr
 

krandr

  • krandr
randr.h
1 /*
2  * Copyright (c) 2002,2003 Hamish Rodda <rodda@kde.org>
3  *
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.
8  *
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.
13  *
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.
17  */
18 
19 #ifndef __RANDR_H__
20 #define __RANDR_H__
21 
22 #include <tqobject.h>
23 #include <tqstringlist.h>
24 #include <tqptrlist.h>
25 
26 #include <kcmodule.h>
27 #include <kconfig.h>
28 
29 class KTimerDialog;
30 class RandRScreenPrivate;
31 
32 struct SingleScreenData {
33  TQString screenFriendlyName;
34  bool generic_screen_detected;
35  bool screen_connected;
36 
37  TQStringList resolutions;
38  TQStringList refresh_rates;
39  TQStringList color_depths;
40  TQStringList rotations;
41 
42  int current_resolution_index;
43  int current_refresh_rate_index;
44  int current_color_depth_index;
45 
46  float gamma_red;
47  float gamma_green;
48  float gamma_blue;
49 
50  int current_rotation_index;
51  int current_orientation_mask;
52  bool has_x_flip;
53  bool has_y_flip;
54  bool supports_transformations;
55 
56  bool is_primary;
57  bool is_extended;
58  int absolute_x_position;
59  int absolute_y_position;
60  int current_x_pixel_count;
61  int current_y_pixel_count;
62 
63  bool has_dpms;
64  bool enable_dpms;
65  unsigned int dpms_standby_delay;
66  unsigned int dpms_suspend_delay;
67  unsigned int dpms_off_delay;
68 };
69 
70 class RandRScreen : public TQObject
71 {
72  Q_OBJECT
73 
74 public:
75  enum orientations {
76  Rotate0 = 0x1,
77  Rotate90 = 0x2,
78  Rotate180 = 0x4,
79  Rotate270 = 0x8,
80  RotateMask = 15,
81  RotationCount = 4,
82  ReflectX = 0x10,
83  ReflectY = 0x20,
84  ReflectMask = 48,
85  OrientationMask = 63,
86  OrientationCount = 6
87  };
88 
89  RandRScreen(int screenIndex);
90  ~RandRScreen();
91 
92  void loadSettings();
93  void setOriginal();
94 
95  bool applyProposed();
96 
100  bool applyProposedAndConfirm();
101 
102 public slots:
103  bool confirm();
104  bool showTestConfigurationDialog();
105 
106 public:
107  TQString changedMessage() const;
108 
109  bool changedFromOriginal() const;
110  void proposeOriginal();
111 
112  bool proposedChanged() const;
113 
114  static TQString rotationName(int rotation, bool pastTense = false, bool capitalised = true);
115  TQPixmap rotationIcon(int rotation) const;
116  TQString currentRotationDescription() const;
117 
118  int rotationIndexToDegree(int rotation) const;
119  int rotationDegreeToIndex(int degree) const;
120 
124  TQStringList refreshRates(int size) const;
125 
126  TQString refreshRateDirectDescription(int rate) const;
127  TQString refreshRateIndirectDescription(int size, int index) const;
128  TQString refreshRateDescription(int size, int index) const;
129 
130  int currentRefreshRate() const;
131  TQString currentRefreshRateDescription() const;
132 
133  // Refresh rate hz <==> index conversion
134  int refreshRateHzToIndex(int size, int hz) const;
135  int refreshRateIndexToHz(int size, int index) const;
136 
140  int numSizes() const;
141  const TQSize& pixelSize(int index) const;
142  const TQSize& mmSize(int index) const;
143  int pixelCount(int index) const;
144 
151  int sizeIndex(TQSize pixelSize) const;
152 
153  int rotations() const;
154 
158  int currentPixelWidth() const;
159  int currentPixelHeight() const;
160  int currentMMWidth() const;
161  int currentMMHeight() const;
162 
163  int currentRotation() const;
164  int currentSize() const;
165 
169  int proposedSize() const;
170  bool proposeSize(int newSize);
171 
172  int proposedRotation() const;
173  void proposeRotation(int newRotation);
174 
175  int proposedRefreshRate() const;
183  bool proposeRefreshRate(int index);
184 
188  void load(KConfig& config);
189  void save(KConfig& config) const;
190 
191 private:
192  RandRScreenPrivate* d;
193 
194  int m_screen;
195 
196  TQValueList<TQSize> m_pixelSizes;
197  TQValueList<TQSize> m_mmSizes;
198  int m_rotations;
199 
200  int m_originalRotation;
201  int m_originalSize;
202  int m_originalRefreshRate;
203 
204  int m_currentRotation;
205  int m_currentSize;
206  int m_currentRefreshRate;
207 
208  int m_proposedRotation;
209  int m_proposedSize;
210  int m_proposedRefreshRate;
211 
212  KTimerDialog* m_shownDialog;
213 
214 private slots:
215  void desktopResized();
216  void shownDialogDestroyed();
217 };
218 
219 typedef TQPtrList<RandRScreen> ScreenList;
220 
221 class RandRDisplay
222 {
223 public:
224  RandRDisplay();
225 
226  bool isValid() const;
227  const TQString& errorCode() const;
228  const TQString& version() const;
229 
230  int eventBase() const;
231  int screenChangeNotifyEvent() const;
232  int errorBase() const;
233 
234  int screenIndexOfWidget(TQWidget* widget);
235 
236  int numScreens() const;
237  RandRScreen* screen(int index);
238 
239  void setCurrentScreen(int index);
240  int currentScreenIndex() const;
241  RandRScreen* currentScreen();
242 
243  void refresh();
244 
252  bool loadDisplay(KConfig& config, bool loadScreens = true);
253  void saveDisplay(KConfig& config, bool applyOnStartup, bool syncTrayApp);
254 
255  static bool applyOnStartup(KConfig& config);
256  static bool syncTrayApp(KConfig& config);
257 
258  void applyProposed(bool confirm = true);
259 
260  bool showTestConfigurationDialog();
261 
262 private:
263  int m_numScreens;
264  int m_currentScreenIndex;
265  RandRScreen* m_currentScreen;
266  ScreenList m_screens;
267 
268  bool m_valid;
269  QString m_errorCode;
270  QString m_version;
271 
272  int m_eventBase;
273  int m_errorBase;
274 };
275 
276 #endif

krandr

Skip menu "krandr"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

krandr

Skip menu "krandr"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for krandr by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |