summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/clientGUIUtils.cpp13
-rw-r--r--src/util/clientGUIUtils.h6
2 files changed, 18 insertions, 1 deletions
diff --git a/src/util/clientGUIUtils.cpp b/src/util/clientGUIUtils.cpp
index 4d4cc0d..a8a9487 100644
--- a/src/util/clientGUIUtils.cpp
+++ b/src/util/clientGUIUtils.cpp
@@ -2,7 +2,7 @@
BlankScreen::BlankScreen()
{
- dpy = XOpenDisplay(NULL);
+ dpy = X11Info::display();
scr = DefaultScreen(dpy);
assert(dpy);
blackColor = BlackPixel(dpy, DefaultScreen(dpy));
@@ -142,3 +142,14 @@ bool BlankScreen::unlock()
lockMsg.clear();
return !(locked = false);
}
+
+static Display* _dpy = 0;
+
+Display* X11Info::display()
+{
+ if(!_dpy)
+ {
+ _dpy = XOpenDisplay(0);
+ }
+ return _dpy;
+}
diff --git a/src/util/clientGUIUtils.h b/src/util/clientGUIUtils.h
index 28b05cc..4da0a99 100644
--- a/src/util/clientGUIUtils.h
+++ b/src/util/clientGUIUtils.h
@@ -36,4 +36,10 @@ private:
int offX, offY;
};
+class X11Info
+{
+public:
+ static Display* display();
+};
+
#endif