aboutsummaryrefslogtreecommitdiff
path: root/src/FbAtoms.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbAtoms.cc')
-rw-r--r--src/FbAtoms.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/FbAtoms.cc b/src/FbAtoms.cc
index e19ba21..4e2c7f5 100644
--- a/src/FbAtoms.cc
+++ b/src/FbAtoms.cc
@@ -19,24 +19,36 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbAtoms.cc,v 1.2 2002/03/18 20:29:16 fluxgen Exp $ 22// $Id: FbAtoms.cc,v 1.3 2002/08/14 21:53:07 fluxgen Exp $
23 23
24#include "FbAtoms.hh" 24#include "FbAtoms.hh"
25 25
26#include <string>
27using namespace std;
28
29FbAtoms *FbAtoms::s_singleton = 0;
30
26FbAtoms::FbAtoms(Display *display):m_init(false) { 31FbAtoms::FbAtoms(Display *display):m_init(false) {
27 if (display) 32 if (s_singleton != 0)
28 initAtoms(display); 33 throw string("You can only create one instance of FbAtoms");
34
35 if (display == 0)
36 throw string("Must supply FbAtoms with an valid display connection");
37
38 s_singleton = this;
39 initAtoms(display);
29} 40}
30 41
31FbAtoms::~FbAtoms() { 42FbAtoms::~FbAtoms() {
32 43
33} 44}
34 45
46FbAtoms *FbAtoms::instance() {
47 assert(s_singleton);
48 return s_singleton;
49}
50
35void FbAtoms::initAtoms(Display *display) { 51void FbAtoms::initAtoms(Display *display) {
36 if (m_init) //already done init?
37 return;
38 else
39 m_init = true;
40 52
41 xa_wm_colormap_windows = 53 xa_wm_colormap_windows =
42 XInternAtom(display, "WM_COLORMAP_WINDOWS", False); 54 XInternAtom(display, "WM_COLORMAP_WINDOWS", False);