diff options
author | fluxgen <fluxgen> | 2003-10-13 19:31:56 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-10-13 19:31:56 (GMT) |
commit | 45905b9b773c9a43a765373ef11f451dc5dcd94a (patch) | |
tree | 6cdebdb47733009e25dd5a7ad7a62a3af752b912 /src/FbTk | |
parent | ea61aa6480fa1ebc9bd8be330fe9d6ee70a963eb (diff) | |
download | fluxbox_paul-45905b9b773c9a43a765373ef11f451dc5dcd94a.zip fluxbox_paul-45905b9b773c9a43a765373ef11f451dc5dcd94a.tar.bz2 |
using auto_ptr
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/KeyUtil.cc | 14 | ||||
-rw-r--r-- | src/FbTk/KeyUtil.hh | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc index 71dc22a..72e78eb 100644 --- a/src/FbTk/KeyUtil.cc +++ b/src/FbTk/KeyUtil.cc | |||
@@ -19,7 +19,7 @@ | |||
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: KeyUtil.cc,v 1.3 2003/10/05 07:20:16 rathnor Exp $ | 22 | // $Id: KeyUtil.cc,v 1.4 2003/10/13 19:31:56 fluxgen Exp $ |
23 | 23 | ||
24 | #include "KeyUtil.hh" | 24 | #include "KeyUtil.hh" |
25 | #include "App.hh" | 25 | #include "App.hh" |
@@ -28,12 +28,12 @@ | |||
28 | 28 | ||
29 | namespace FbTk { | 29 | namespace FbTk { |
30 | 30 | ||
31 | KeyUtil *KeyUtil::s_keyutil = 0; | 31 | std::auto_ptr<KeyUtil> KeyUtil::s_keyutil; |
32 | 32 | ||
33 | KeyUtil *KeyUtil::instance() { | 33 | KeyUtil &KeyUtil::instance() { |
34 | if (s_keyutil == 0) | 34 | if (s_keyutil.get() == 0) |
35 | s_keyutil = new KeyUtil(); | 35 | s_keyutil.reset(new KeyUtil()); |
36 | return s_keyutil; | 36 | return *s_keyutil.get(); |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
@@ -170,7 +170,7 @@ void KeyUtil::ungrabKeys() { | |||
170 | } | 170 | } |
171 | 171 | ||
172 | unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { | 172 | unsigned int KeyUtil::keycodeToModmask(unsigned int keycode) { |
173 | XModifierKeymap *modmap = instance()->m_modmap; | 173 | XModifierKeymap *modmap = instance().m_modmap; |
174 | 174 | ||
175 | if (!modmap) return 0; | 175 | if (!modmap) return 0; |
176 | 176 | ||
diff --git a/src/FbTk/KeyUtil.hh b/src/FbTk/KeyUtil.hh index a6051f6..019fbc5 100644 --- a/src/FbTk/KeyUtil.hh +++ b/src/FbTk/KeyUtil.hh | |||
@@ -19,7 +19,7 @@ | |||
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: KeyUtil.hh,v 1.2 2003/10/05 07:20:35 rathnor Exp $ | 22 | // $Id: KeyUtil.hh,v 1.3 2003/10/13 19:31:56 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_KEYUTIL_HH | 24 | #ifndef FBTK_KEYUTIL_HH |
25 | #define FBTK_KEYUTIL_HH | 25 | #define FBTK_KEYUTIL_HH |
@@ -27,6 +27,8 @@ | |||
27 | #include <X11/Xlib.h> | 27 | #include <X11/Xlib.h> |
28 | #include <X11/keysym.h> | 28 | #include <X11/keysym.h> |
29 | 29 | ||
30 | #include <memory> | ||
31 | |||
30 | namespace FbTk { | 32 | namespace FbTk { |
31 | 33 | ||
32 | class KeyUtil { | 34 | class KeyUtil { |
@@ -36,7 +38,7 @@ public: | |||
36 | ~KeyUtil(); | 38 | ~KeyUtil(); |
37 | 39 | ||
38 | void init(); | 40 | void init(); |
39 | static KeyUtil *instance(); | 41 | static KeyUtil &instance(); |
40 | 42 | ||
41 | /** | 43 | /** |
42 | Grab the specified key | 44 | Grab the specified key |
@@ -78,7 +80,7 @@ private: | |||
78 | void loadModmap(); | 80 | void loadModmap(); |
79 | 81 | ||
80 | XModifierKeymap *m_modmap; | 82 | XModifierKeymap *m_modmap; |
81 | static KeyUtil *s_keyutil; | 83 | static std::auto_ptr<KeyUtil> s_keyutil; |
82 | }; | 84 | }; |
83 | 85 | ||
84 | } // end namespace FbTk | 86 | } // end namespace FbTk |