libtderandr.h
00001 /* libtderandr.h - class KRandr that makes it easy to use XRandr in KDE 00002 This file is part of KRandr 0.9.5 00003 Copyright (C) 2010 Timothy Pearson 00004 LibKRandr's homepage : http://www.trinitydesktop.org 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 00021 Send comments and bug fixes to Timothy Pearson <kb9vqf@pearsoncomputing.net> 00022 00023 ***************************************************************************/ 00024 #ifndef _LIBTDERANDR_H 00025 #define _LIBTDERANDR_H 00026 00027 #include "randr.h" 00028 #include "lowlevel_randr.h" 00029 00030 #ifdef __cplusplus 00031 00032 #include <tqfile.h> 00033 00034 #include <tdeconfig.h> 00035 #include <ksimpleconfig.h> 00036 #include <tdelibs_export.h> 00037 00038 #define ROTATION_0_DEGREES_STRING "0 degrees" 00039 #define ROTATION_90_DEGREES_STRING "90 degrees" 00040 #define ROTATION_180_DEGREES_STRING "180 degrees" 00041 #define ROTATION_270_DEGREES_STRING "270 degrees" 00042 00053 class TDERANDR_EXPORT KRandrSimpleAPI : public RandRDisplay 00054 { 00055 private: 00056 00057 public: 00061 TQString getIccFileName(TQString profileName, TQString screenName, TQString kde_confdir); 00062 00067 TQString applyIccFile(TQString screenName, TQString fileName); 00068 00073 TQString applyIccConfiguration(TQString profileName, TQString kde_confdir); 00074 00078 TQString applySystemWideIccConfiguration(TQString kde_confdir); 00079 00083 TQString clearIccConfiguration(void); 00084 00088 TQString getCurrentProfile(void); 00089 00094 ScreenInfo* read_screen_info(Display *display); 00095 00099 void freeScreenInfoStructure(ScreenInfo* screen_info); 00100 00104 int set_screen_size (ScreenInfo *screen_info); 00105 00109 void output_auto (ScreenInfo *screen_info, OutputInfo *output_info); 00110 00114 void output_off(ScreenInfo *screen_info, OutputInfo *output); 00115 00119 CrtcInfo* auto_find_crtc (ScreenInfo *screen_info, OutputInfo *output_info); 00120 00124 XRRModeInfo *find_mode_by_xid (ScreenInfo *screen_info, RRMode mode_id); 00125 00129 int mode_height (XRRModeInfo *mode_info, Rotation rotation); 00130 00134 int mode_width (XRRModeInfo *mode_info, Rotation rotation); 00135 00139 int get_width_by_output_id (ScreenInfo *screen_info, RROutput output_id); 00140 00144 int get_height_by_output_id (ScreenInfo *screen_info, RROutput output_id); 00145 00149 char *get_output_name (ScreenInfo *screen_info, RROutput id); 00150 00154 Status crtc_apply (CrtcInfo *crtc_info); 00155 00159 Status crtc_disable (CrtcInfo *crtc); 00160 00164 int main_low_apply (ScreenInfo *screen_info); 00165 00169 void set_primary_output (ScreenInfo *screen_info, RROutput output_id); 00170 00174 TQByteArray getEDID(int card, TQString displayname); 00175 00179 TQString getEDIDMonitorName(int card, TQString displayname); 00180 00184 bool getDisplayConfigurationEnabled(TQString kde_confdir); 00185 00189 bool getDisplayConfigurationStartupAutoApplyEnabled(TQString kde_confdir); 00190 00194 TQString getDisplayConfigurationStartupAutoApplyName(TQString kde_confdir); 00195 00199 HotPlugRulesList getHotplugRules(TQString kde_confdir); 00200 00204 void saveHotplugRules(HotPlugRulesList rules, TQString kde_confdir); 00205 00209 void applyHotplugRules(TQString kde_confdir); 00210 00215 TQStringList getDisplayConfigurationProfiles(TQString kde_confdir); 00216 00221 bool deleteDisplayConfiguration(TQString profilename, TQString kde_confdir); 00222 00227 bool renameDisplayConfiguration(TQString profilename, TQString newprofilename, TQString kde_confdir); 00228 00234 void saveDisplayConfiguration(bool enable, bool applyonstart, TQString profilename, TQString defaultprofilename, TQString kde_confdir, TQPtrList<SingleScreenData> screenInfoArray); 00235 00241 TQPtrList<SingleScreenData> loadDisplayConfiguration(TQString profilename, TQString kde_confdir); 00242 00247 TQPoint applyStartupDisplayConfiguration(TQString kde_confdir); 00248 00254 TQPoint applyDisplayConfiguration(TQString profilename, TQString kde_confdir); 00255 00261 bool applyDisplayConfiguration(TQPtrList<SingleScreenData> screenInfoArray, bool test=TRUE, TQString kde_confdir=""); 00262 00266 void applyDisplayGamma(TQPtrList<SingleScreenData> screenInfoArray); 00267 00271 void applyDisplayDPMS(TQPtrList<SingleScreenData> screenInfoArray); 00272 00276 TQPtrList<SingleScreenData> copyScreenInformationObject(TQPtrList<SingleScreenData> screenInfoArray); 00277 00281 void destroyScreenInformationObject(TQPtrList<SingleScreenData> screenInfoArray); 00282 00286 TQPoint primaryScreenOffsetFromTLC(TQPtrList<SingleScreenData> screenInfoArray); 00287 00291 void ensureMonitorDataConsistency(TQPtrList<SingleScreenData> screenInfoArray); 00292 00296 TQPtrList<SingleScreenData> readCurrentDisplayConfiguration(); 00297 00301 int getHardwareRotationFlags(SingleScreenData*); 00302 00306 bool kRandrHasRandr(); 00307 00311 static const char *kRandrVersion(void); 00312 00320 static const char *kRandrCopyright(void); 00321 00322 }; 00323 00324 00325 00326 extern "C" { 00327 00328 #else 00329 #define TDERANDR_EXPORT 00330 #endif 00331 00332 // TDERANDR_EXPORT ScreenInfo* read_screen_info(Display *); 00333 // TDERANDR_EXPORT int set_screen_size (ScreenInfo *screen_info); 00334 // TDERANDR_EXPORT void output_auto (ScreenInfo *screen_info, OutputInfo *output_info); 00335 // TDERANDR_EXPORT void output_off(ScreenInfo *screen_info, OutputInfo *output); 00336 // TDERANDR_EXPORT CrtcInfo* auto_find_crtc (ScreenInfo *screen_info, OutputInfo *output_info); 00337 // TDERANDR_EXPORT XRRModeInfo *find_mode_by_xid (ScreenInfo *screen_info, RRMode mode_id); 00338 // TDERANDR_EXPORT int mode_height (XRRModeInfo *mode_info, Rotation rotation); 00339 // TDERANDR_EXPORT int mode_width (XRRModeInfo *mode_info, Rotation rotation); 00340 // TDERANDR_EXPORT int get_width_by_output_id (ScreenInfo *screen_info, RROutput output_id); 00341 // TDERANDR_EXPORT int get_height_by_output_id (ScreenInfo *screen_info, RROutput output_id); 00342 // TDERANDR_EXPORT char *get_output_name (ScreenInfo *screen_info, RROutput id); 00343 // TDERANDR_EXPORT Status crtc_apply (CrtcInfo *crtc_info); 00344 // TDERANDR_EXPORT Status crtc_disable (CrtcInfo *crtc); 00345 // TDERANDR_EXPORT int main_low_apply (ScreenInfo *screen_info); 00346 // TDERANDR_EXPORT bool kRandrHasRandr(); 00347 00348 TDERANDR_EXPORT const char *kRandrVersion(void); 00349 TDERANDR_EXPORT const char *kRandrCopyright(void); 00350 00351 #ifdef __cplusplus 00352 00353 } 00354 00355 00356 #endif 00357 00358 00359 #endif