00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __RANDR_H__
00020 #define __RANDR_H__
00021
00022 #include <tqobject.h>
00023 #include <tqstringlist.h>
00024 #include <tqptrlist.h>
00025
00026 #include <tdecmodule.h>
00027 #include <tdeconfig.h>
00028
00029 class KTimerDialog;
00030 class RandRScreenPrivate;
00031
00032 class TDERANDR_EXPORT HotPlugRule {
00033 public:
00034 enum states {
00035 AnyState = 0,
00036 Connected = 1,
00037 Disconnected = 2
00038 };
00039
00040 public:
00041 HotPlugRule();
00042 virtual ~HotPlugRule();
00043
00044 public:
00045 TQStringList outputs;
00046 TQValueList< int > states;
00047 TQString profileName;
00048 };
00049
00050 typedef TQValueList< HotPlugRule > HotPlugRulesList;
00051
00052 class TDERANDR_EXPORT SingleScreenData {
00053 public:
00054 SingleScreenData();
00055 virtual ~SingleScreenData();
00056
00057 public:
00058 TQString screenUniqueName;
00059 TQString screenFriendlyName;
00060 bool generic_screen_detected;
00061 bool screen_connected;
00062
00063 TQStringList resolutions;
00064 TQStringList refresh_rates;
00065 TQStringList color_depths;
00066 TQStringList rotations;
00067
00068 int current_resolution_index;
00069 int current_refresh_rate_index;
00070 int current_color_depth_index;
00071
00072 float gamma_red;
00073 float gamma_green;
00074 float gamma_blue;
00075
00076 int current_rotation_index;
00077 int current_orientation_mask;
00078 bool has_x_flip;
00079 bool has_y_flip;
00080 bool supports_transformations;
00081
00082 bool is_primary;
00083 bool is_extended;
00084 int absolute_x_position;
00085 int absolute_y_position;
00086 int current_x_pixel_count;
00087 int current_y_pixel_count;
00088
00089 bool has_dpms;
00090 bool enable_dpms;
00091 unsigned int dpms_standby_delay;
00092 unsigned int dpms_suspend_delay;
00093 unsigned int dpms_off_delay;
00094 };
00095
00096 class RandRScreen : public TQObject
00097 {
00098 Q_OBJECT
00099
00100 public:
00101 enum orientations {
00102 Rotate0 = 0x1,
00103 Rotate90 = 0x2,
00104 Rotate180 = 0x4,
00105 Rotate270 = 0x8,
00106 RotateMask = 15,
00107 RotationCount = 4,
00108 ReflectX = 0x10,
00109 ReflectY = 0x20,
00110 ReflectMask = 48,
00111 OrientationMask = 63,
00112 OrientationCount = 6
00113 };
00114
00115 RandRScreen(int screenIndex);
00116 ~RandRScreen();
00117
00118 void loadSettings();
00119 void setOriginal();
00120
00121 bool applyProposed();
00122
00126 bool applyProposedAndConfirm();
00127
00128 public slots:
00129 bool confirm();
00130 bool showTestConfigurationDialog();
00131
00132 public:
00133 TQString changedMessage() const;
00134
00135 bool changedFromOriginal() const;
00136 void proposeOriginal();
00137
00138 bool proposedChanged() const;
00139
00140 static TQString rotationName(int rotation, bool pastTense = false, bool capitalised = true);
00141 TQPixmap rotationIcon(int rotation) const;
00142 TQString currentRotationDescription() const;
00143
00144 int rotationIndexToDegree(int rotation) const;
00145 int rotationDegreeToIndex(int degree) const;
00146
00150 TQStringList refreshRates(int size) const;
00151
00152 TQString refreshRateDirectDescription(int rate) const;
00153 TQString refreshRateIndirectDescription(int size, int index) const;
00154 TQString refreshRateDescription(int size, int index) const;
00155
00156 int currentRefreshRate() const;
00157 TQString currentRefreshRateDescription() const;
00158
00159
00160 int refreshRateHzToIndex(int size, int hz) const;
00161 int refreshRateIndexToHz(int size, int index) const;
00162
00166 int numSizes() const;
00167 const TQSize& pixelSize(int index) const;
00168 const TQSize& mmSize(int index) const;
00169 int pixelCount(int index) const;
00170
00177 int sizeIndex(TQSize pixelSize) const;
00178
00179 int rotations() const;
00180
00184 int currentPixelWidth() const;
00185 int currentPixelHeight() const;
00186 int currentMMWidth() const;
00187 int currentMMHeight() const;
00188
00189 int currentRotation() const;
00190 int currentSize() const;
00191
00195 int proposedSize() const;
00196 bool proposeSize(int newSize);
00197
00198 int proposedRotation() const;
00199 void proposeRotation(int newRotation);
00200
00201 int proposedRefreshRate() const;
00209 bool proposeRefreshRate(int index);
00210
00214 void load(TDEConfig& config);
00215 void save(TDEConfig& config) const;
00216
00217 private:
00218 RandRScreenPrivate* d;
00219
00220 int m_screen;
00221
00222 TQValueList<TQSize> m_pixelSizes;
00223 TQValueList<TQSize> m_mmSizes;
00224 int m_rotations;
00225
00226 int m_originalRotation;
00227 int m_originalSize;
00228 int m_originalRefreshRate;
00229
00230 int m_currentRotation;
00231 int m_currentSize;
00232 int m_currentRefreshRate;
00233
00234 int m_proposedRotation;
00235 int m_proposedSize;
00236 int m_proposedRefreshRate;
00237
00238 KTimerDialog* m_shownDialog;
00239
00240 private slots:
00241 void desktopResized();
00242 void shownDialogDestroyed();
00243 };
00244
00245 typedef TQPtrList<RandRScreen> ScreenList;
00246
00247 class RandRDisplay
00248 {
00249 public:
00250 RandRDisplay();
00251
00252 bool isValid() const;
00253 const TQString& errorCode() const;
00254 const TQString& version() const;
00255
00256 int eventBase() const;
00257 int screenChangeNotifyEvent() const;
00258 int errorBase() const;
00259
00260 int screenIndexOfWidget(TQWidget* widget);
00261
00262 int numScreens() const;
00263 RandRScreen* screen(int index);
00264
00265 void setCurrentScreen(int index);
00266 int currentScreenIndex() const;
00267 RandRScreen* currentScreen();
00268
00269 void refresh();
00270
00278 bool loadDisplay(TDEConfig& config, bool loadScreens = true);
00279 void saveDisplay(TDEConfig& config, bool applyOnStartup, bool syncTrayApp);
00280
00281 static bool applyOnStartup(TDEConfig& config);
00282 static bool syncTrayApp(TDEConfig& config);
00283
00284 void applyProposed(bool confirm = true);
00285
00286 bool showTestConfigurationDialog();
00287
00288 private:
00289 int m_numScreens;
00290 int m_currentScreenIndex;
00291 RandRScreen* m_currentScreen;
00292 ScreenList m_screens;
00293
00294 bool m_valid;
00295 QString m_errorCode;
00296 QString m_version;
00297
00298 int m_eventBase;
00299 int m_errorBase;
00300 };
00301
00302 #endif