summaryrefslogtreecommitdiffstats
path: root/src/displaymanager.cpp
diff options
context:
space:
mode:
authorManuel Schneider2013-10-18 11:25:12 +0200
committerManuel Schneider2013-10-18 11:25:12 +0200
commit9a9ffe7eebf14ea1828480c2e175e4fc39e26dac (patch)
tree86891f6237e419a35b74f465ec450ffbe9506d7d /src/displaymanager.cpp
downloadbeamergui-9a9ffe7eebf14ea1828480c2e175e4fc39e26dac.tar.gz
beamergui-9a9ffe7eebf14ea1828480c2e175e4fc39e26dac.tar.xz
beamergui-9a9ffe7eebf14ea1828480c2e175e4fc39e26dac.zip
[Incomplete] Commit for EDID testsystem
Diffstat (limited to 'src/displaymanager.cpp')
-rw-r--r--src/displaymanager.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/displaymanager.cpp b/src/displaymanager.cpp
new file mode 100644
index 0000000..61f35ea
--- /dev/null
+++ b/src/displaymanager.cpp
@@ -0,0 +1,36 @@
+#include "displaymanager.h"
+
+
+DisplayManager * DisplayManager::Instance = NULL;
+
+DisplayManager::DisplayManager()
+{
+ dpy = NULL;
+ resources = NULL;
+
+
+ // Get initial data (to be freed)
+ dpy = XOpenDisplay(NULL);
+ resources = XRRGetScreenResourcesCurrent(dpy, DefaultRootWindow(dpy));
+
+ // Get outputs
+ for (int i = 0; i < resources->noutput; ++i) {
+ XRROutputInfo *info = XRRGetOutputInfo (dpy, resources, resources->outputs[i]);
+ if (info->connection == RR_Connected)
+ Outputs.push_back(Output(dpy, resources, resources->outputs[i]));
+ XRRFreeOutputInfo(info);
+ }
+}
+
+DisplayManager::~DisplayManager()
+{
+ XCloseDisplay(dpy);
+ XRRFreeScreenResources(resources);
+}
+
+DisplayManager *DisplayManager::Inst()
+{
+ if (Instance == 0)
+ Instance = new DisplayManager();
+ return Instance;
+}