summaryrefslogtreecommitdiffstats
path: root/src/x.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/x.h')
-rw-r--r--src/x.h97
1 files changed, 0 insertions, 97 deletions
diff --git a/src/x.h b/src/x.h
deleted file mode 100644
index b5df6e0..0000000
--- a/src/x.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef XRANDR_H
-#define XRANDR_H
-
-#include <QDebug>
-#include <QList>
-#include <QHash>
-#include <QString>
-#include <QRect>
-#include <QSet>
-#include <QSize>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
-
-struct OutputInfo;
-
-typedef QHash<RRMode, XRRModeInfo*> ModeMap;
-typedef QHash<RRCrtc, XRRCrtcInfo*> CrtcMap;
-typedef QHash<RROutput, OutputInfo*> OutputMap;
-typedef QVector<QSize> ResolutionVector;
-
-///////////////////////////////////////////////////////////////////////////
-
-enum class ScreenMode
-{
- Single,
- Clone,
- Dual,
- Advanced,
-};
-
-class ScreenInfo
-{
-public:
- ScreenInfo(const OutputInfo *oi, const ModeMap &om);
- int position;
- QString name;
- QString output;
- QSize currentResolution;
- QSize preferredResolution;
- bool isProjector;
- ResolutionVector modes;
-};
-
-class ScreenSetup
-{
-public:
- void updateScreenResources();
- void initModes();
- XRRModeInfo* getPreferredMode(OutputInfo *oi) const;
- QList<QSize> getTotalSize(const QList<OutputInfo*> &projectors, const QList<OutputInfo*> &screens) const;
- ScreenMode getCurrentMode();
- ScreenMode setDefaultMode(bool dryRun = false);
- void copyModesToAll(RROutput id, int num);
- bool createMode(unsigned int resX, unsigned int resY, float refresh, QString name);
- void revertChanges();
- bool setClone(const QSize &resolution);
- bool setCustom(const QList<QPair<QSize, QList<QString>>> &list);
- ResolutionVector getCommonModes() const;
- int getOutputCount() const { return _outputMap.size(); }
- QMap<QString, ScreenInfo> getScreenPositions() const;
- const ResolutionVector &getVirtualResolutions() const { return _resolutions; }
-
- // Singleton
- inline static ScreenSetup* inst() {
- if (_instance == nullptr) _instance = new ScreenSetup();
- return _instance;
- }
-
-private:
- ScreenSetup();
- ~ScreenSetup();
-
- 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;
- bool setOutputResolution(OutputInfo *oi, int x, int y, const QSize &size, bool dryRun = false);
-
- static ScreenSetup * _instance;
- Display* _display;
- Atom _EDID_ATOM;
- XRRScreenResources* _screenResources;
- ModeMap _modeMap;
- CrtcMap _crtcMap;
- CrtcMap _crtcBackup;
- OutputMap _outputMap;
- ResolutionVector _resolutions;
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-#endif // XRANDR_H