summaryrefslogtreecommitdiffstats
path: root/src/xx.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xx.h')
-rw-r--r--src/xx.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/xx.h b/src/xx.h
new file mode 100644
index 0000000..a17d4b7
--- /dev/null
+++ b/src/xx.h
@@ -0,0 +1,66 @@
+#ifndef XRANDR_H
+#define XRANDR_H
+
+#include <QList>
+#include <QString>
+#include <QSize>
+
+struct ScreenInfo;
+class XPrivate;
+
+typedef QVector<QSize> ResolutionVector;
+
+///////////////////////////////////////////////////////////////////////////
+
+enum class ScreenMode
+{
+ Single,
+ Clone,
+ Dual,
+ Advanced,
+};
+
+struct ScreenInfo
+{
+ int position;
+ QString name;
+ QString output;
+ QSize currentResolution;
+ QSize preferredResolution;
+ bool isProjector;
+ ResolutionVector modes;
+};
+
+class ScreenSetup
+{
+public:
+ void updateScreenResources();
+ void initModes();
+ ScreenMode getCurrentMode();
+ ScreenMode setDefaultMode(bool dryRun = false);
+ 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;
+ QMap<QString, ScreenInfo> getScreenPositions() const;
+ const ResolutionVector &getVirtualResolutions() const;
+
+ // Singleton
+ inline static ScreenSetup* inst() {
+ if (_instance == nullptr) _instance = new ScreenSetup();
+ return _instance;
+ }
+
+private:
+ ScreenSetup();
+ ~ScreenSetup();
+
+ static ScreenSetup * _instance;
+ XPrivate *a;
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+#endif // XRANDR_H