diff options
Diffstat (limited to 'src/x.h')
-rw-r--r-- | src/x.h | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -13,6 +13,10 @@ struct OutputInfo; +typedef QHash<RRMode, XRRModeInfo*> ModeMap; +typedef QHash<RRCrtc, XRRCrtcInfo*> CrtcMap; +typedef QHash<RROutput, OutputInfo*> OutputMap; +typedef QVector<QSize> ResolutionVector; /////////////////////////////////////////////////////////////////////////// @@ -24,17 +28,23 @@ enum class ScreenMode Advanced, }; -class ScreenSetup +class ScreenInfo { public: + ScreenInfo(const OutputInfo *oi, const ModeMap &om); + int position; + QString name; + QString output; + QSize currentResolution; + QSize preferredResolution; + bool isProjector; + ResolutionVector modes; +}; - typedef QHash<RRMode, XRRModeInfo*> ModeMap; - typedef QHash<RRCrtc, XRRCrtcInfo*> CrtcMap; - typedef QHash<RROutput, OutputInfo*> OutputMap; - typedef QVector<QSize> ResolutionVector; - +class ScreenSetup +{ +public: void updateScreenResources(); - bool applyChanges(); void initModes(); XRRModeInfo* getPreferredMode(OutputInfo *oi) const; QList<QSize> getTotalSize(const QList<OutputInfo*> &projectors, const QList<OutputInfo*> &screens) const; @@ -42,12 +52,13 @@ public: ScreenMode getCurrentMode(); ScreenMode setDefaultMode(bool dryRun = false); void copyModesToAll(RROutput id, int num); - RRMode getOutputModeForResolution(const XRROutputInfo *output, unsigned int width, unsigned int height) const; bool createMode(unsigned int resX, unsigned int resY, float refresh, QString name); void revertChanges(); - QList<QPair<quint32, quint32>> getCommonModes() const; + bool setClone(const QSize &resolution); + bool setCustom(const QList<QPair<QSize, QList<QString>>> &list); + ResolutionVector getCommonModes() const; int getOutputCount() const { return _outputMap.size(); } - QHash<QString, int> getScreenPositions() const; + QMap<QString, ScreenInfo> getScreenPositions() const; const ResolutionVector &getVirtualResolutions() const { return _resolutions; } // Singleton @@ -62,6 +73,13 @@ private: void freeResources(); bool readEdid(OutputInfo* output); + void createCrtcBackup(); + void freeCrtcBackup(); + void disconnectAllCrtcs(); + void setScreenSize(const QSize &size); + RRMode getOutputModeForResolution(const XRROutputInfo *output, unsigned int width, unsigned int height) const; + RRMode getOutputModeForResolution(const XRROutputInfo *output, const QSize &resolution) const; + RRCrtc getFreeCrtc(const XRROutputInfo* output) const; static ScreenSetup * _instance; Display* _display; @@ -69,6 +87,7 @@ private: XRRScreenResources* _screenResources; ModeMap _modeMap; CrtcMap _crtcMap; + CrtcMap _crtcBackup; OutputMap _outputMap; ResolutionVector _resolutions; }; |