aboutsummaryrefslogtreecommitdiff
path: root/src/FbAtoms.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbAtoms.cc')
-rw-r--r--src/FbAtoms.cc44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/FbAtoms.cc b/src/FbAtoms.cc
index 13b1703..409a99f 100644
--- a/src/FbAtoms.cc
+++ b/src/FbAtoms.cc
@@ -22,42 +22,36 @@
22#include "FbAtoms.hh" 22#include "FbAtoms.hh"
23#include "FbTk/App.hh" 23#include "FbTk/App.hh"
24 24
25#include <string> 25namespace {
26 26
27using std::string; 27FbAtoms* s_singleton = 0;
28 28
29FbAtoms *FbAtoms::s_singleton = 0; 29} // end of anonymous namespace
30 30
31FbAtoms::FbAtoms():m_init(false) { 31FbAtoms::FbAtoms() {
32 if (s_singleton != 0) 32
33 throw string("You can only create one instance of FbAtoms"); 33 Display* dpy = FbTk::App::instance()->display();
34
35 xa_wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
36 xa_wm_state = XInternAtom(dpy, "WM_STATE", False);
37 xa_wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
38 xa_wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
39 xa_wm_take_focus = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
40 motif_wm_hints = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
41
42 blackbox_attributes = XInternAtom(dpy, "_BLACKBOX_ATTRIBUTES", False);
34 43
35 s_singleton = this; 44 s_singleton = this;
36 initAtoms();
37} 45}
38 46
39FbAtoms::~FbAtoms() { 47FbAtoms::~FbAtoms() {
40 48 s_singleton = 0;
41} 49}
42 50
43FbAtoms *FbAtoms::instance() { 51FbAtoms *FbAtoms::instance() {
44 if (s_singleton == 0) 52 if (s_singleton == 0) {
45 throw string("Create one instance of FbAtoms first!"); 53 s_singleton = new FbAtoms();
54 }
46 return s_singleton; 55 return s_singleton;
47} 56}
48 57
49void FbAtoms::initAtoms() {
50 Display *display = FbTk::App::instance()->display();
51 if (display == 0)
52 return;
53
54 xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False);
55 xa_wm_state = XInternAtom(display, "WM_STATE", False);
56 xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
57 xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
58 xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False);
59 motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
60
61 blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False);
62
63}