diff options
Diffstat (limited to 'src/FbAtoms.cc')
-rw-r--r-- | src/FbAtoms.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/FbAtoms.cc b/src/FbAtoms.cc index b68a8bd..5a75f2b 100644 --- a/src/FbAtoms.cc +++ b/src/FbAtoms.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // FbAtom.cc | 1 | // FbAtom.cc |
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen(at)linuxmail.org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -13,30 +13,30 @@ | |||
13 | // | 13 | // |
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
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.5 2002/12/01 13:41:56 rathnor Exp $ | 22 | // $Id: FbAtoms.cc,v 1.6 2003/04/15 11:59:02 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbAtoms.hh" | 24 | #include "FbAtoms.hh" |
25 | #include "App.hh" | ||
25 | 26 | ||
26 | #include <string> | 27 | #include <string> |
28 | #include <cassert> | ||
29 | |||
27 | using namespace std; | 30 | using namespace std; |
28 | 31 | ||
29 | FbAtoms *FbAtoms::s_singleton = 0; | 32 | FbAtoms *FbAtoms::s_singleton = 0; |
30 | 33 | ||
31 | FbAtoms::FbAtoms(Display *display):m_init(false) { | 34 | FbAtoms::FbAtoms():m_init(false) { |
32 | if (s_singleton != 0) | 35 | if (s_singleton != 0) |
33 | throw string("You can only create one instance of FbAtoms"); | 36 | throw string("You can only create one instance of FbAtoms"); |
34 | 37 | ||
35 | if (display == 0) | ||
36 | throw string("Must supply FbAtoms with an valid display connection"); | ||
37 | |||
38 | s_singleton = this; | 38 | s_singleton = this; |
39 | initAtoms(display); | 39 | initAtoms(); |
40 | } | 40 | } |
41 | 41 | ||
42 | FbAtoms::~FbAtoms() { | 42 | FbAtoms::~FbAtoms() { |
@@ -44,11 +44,14 @@ FbAtoms::~FbAtoms() { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | FbAtoms *FbAtoms::instance() { | 46 | FbAtoms *FbAtoms::instance() { |
47 | assert(s_singleton); | 47 | if (s_singleton == 0) |
48 | throw string("Create one instance of FbAtoms first!"); | ||
49 | |||
48 | return s_singleton; | 50 | return s_singleton; |
49 | } | 51 | } |
50 | 52 | ||
51 | void FbAtoms::initAtoms(Display *display) { | 53 | void FbAtoms::initAtoms() { |
54 | Display *display = FbTk::App::instance()->display(); | ||
52 | 55 | ||
53 | xa_wm_colormap_windows = | 56 | xa_wm_colormap_windows = |
54 | XInternAtom(display, "WM_COLORMAP_WINDOWS", False); | 57 | XInternAtom(display, "WM_COLORMAP_WINDOWS", False); |
@@ -57,7 +60,6 @@ void FbAtoms::initAtoms(Display *display) { | |||
57 | xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False); | 60 | xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False); |
58 | xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); | 61 | xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); |
59 | xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False); | 62 | xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False); |
60 | motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); | ||
61 | 63 | ||
62 | blackbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False); | 64 | blackbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False); |
63 | blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False); | 65 | blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False); |