From 266eb5fb14c07e67aa211a5860e9abf3009136e3 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Mon, 4 Oct 2010 00:22:14 +0200 Subject: Implement first version of basic input event support --- src/util/clientGUIUtils.cpp | 13 ++++++++++++- src/util/clientGUIUtils.h | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/util') 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 -- cgit v1.2.3-55-g7522