diff options
-rw-r--r-- | src/FbAtoms.cc | 24 | ||||
-rw-r--r-- | src/FbAtoms.hh | 18 |
2 files changed, 22 insertions, 20 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); |
diff --git a/src/FbAtoms.hh b/src/FbAtoms.hh index 327e26e..39bd380 100644 --- a/src/FbAtoms.hh +++ b/src/FbAtoms.hh | |||
@@ -1,5 +1,5 @@ | |||
1 | // FbAtom.hh | 1 | // FbAtom.hh |
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen(at)fluxbox.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,13 +13,13 @@ | |||
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.hh,v 1.8 2002/12/01 13:41:56 rathnor Exp $ | 22 | // $Id: FbAtoms.hh,v 1.9 2003/04/15 11:57:34 fluxgen Exp $ |
23 | #ifndef FBATOMS_HH | 23 | #ifndef FBATOMS_HH |
24 | #define FBATOMS_HH | 24 | #define FBATOMS_HH |
25 | 25 | ||
@@ -31,8 +31,9 @@ | |||
31 | */ | 31 | */ |
32 | class FbAtoms { | 32 | class FbAtoms { |
33 | public: | 33 | public: |
34 | explicit FbAtoms(Display *display); | 34 | FbAtoms(); |
35 | virtual ~FbAtoms(); | 35 | ~FbAtoms(); |
36 | |||
36 | static FbAtoms *instance(); | 37 | static FbAtoms *instance(); |
37 | 38 | ||
38 | 39 | ||
@@ -42,7 +43,6 @@ public: | |||
42 | inline Atom getWMProtocolsAtom() const { return xa_wm_protocols; } | 43 | inline Atom getWMProtocolsAtom() const { return xa_wm_protocols; } |
43 | inline Atom getWMTakeFocusAtom() const { return xa_wm_take_focus; } | 44 | inline Atom getWMTakeFocusAtom() const { return xa_wm_take_focus; } |
44 | inline Atom getWMColormapAtom() const { return xa_wm_colormap_windows; } | 45 | inline Atom getWMColormapAtom() const { return xa_wm_colormap_windows; } |
45 | inline Atom getMotifWMHintsAtom() const { return motif_wm_hints; } | ||
46 | 46 | ||
47 | // this atom is for normal app->WM hints about decorations, stacking, | 47 | // this atom is for normal app->WM hints about decorations, stacking, |
48 | // starting workspace etc... | 48 | // starting workspace etc... |
@@ -77,7 +77,7 @@ public: | |||
77 | inline Atom getFluxboxCycleWindowFocusAtom() const { return blackbox_cycle_window_focus; } | 77 | inline Atom getFluxboxCycleWindowFocusAtom() const { return blackbox_cycle_window_focus; } |
78 | 78 | ||
79 | private: | 79 | private: |
80 | void initAtoms(Display *disp); | 80 | void initAtoms(); |
81 | // NETAttributes | 81 | // NETAttributes |
82 | Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints; | 82 | Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints; |
83 | 83 | ||
@@ -93,8 +93,8 @@ private: | |||
93 | blackbox_cycle_window_focus; | 93 | blackbox_cycle_window_focus; |
94 | 94 | ||
95 | Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state, | 95 | Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state, |
96 | xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state, | 96 | xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state; |
97 | motif_wm_hints; | 97 | |
98 | bool m_init; | 98 | bool m_init; |
99 | static FbAtoms *s_singleton; | 99 | static FbAtoms *s_singleton; |
100 | }; | 100 | }; |