From be03b0a3dc916cd9a320a41e38ab57555f8d2a94 Mon Sep 17 00:00:00 2001 From: mathias Date: Tue, 11 Apr 2006 19:22:24 +0000 Subject: cosmetic, closes #1467926 --- ChangeLog | 2 ++ src/Keys.cc | 10 +++++----- src/Keys.hh | 39 +++++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6238678..fb94577 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Changes for 0.9.16: *06/04/11: * Fix calculation of prevWorkspace (Mathias) Screen.cc + * Cosmetic, close #1467926 (thanx Jonas Koelker) + Keys.hh/cc *06/04/09: * Fix label background update with external tabs (Simon) FbWinFrame.cc diff --git a/src/Keys.cc b/src/Keys.cc index 626e836..5e30726 100644 --- a/src/Keys.cc +++ b/src/Keys.cc @@ -111,11 +111,11 @@ Keys::~Keys() { /// Destroys the keytree void Keys::deleteTree() { - while (!m_keylist.empty()) { - if (m_keylist.back()) - delete m_keylist.back(); - m_keylist.pop_back(); - } + keylist_t::iterator it = m_keylist.begin(); + const keylist_t::iterator end = m_keylist.end(); + for ( ; it != end; it++) + delete *it; + m_keylist.clear(); } /** diff --git a/src/Keys.hh b/src/Keys.hh index 3463795..75a8a68 100644 --- a/src/Keys.hh +++ b/src/Keys.hh @@ -75,40 +75,43 @@ private: void deleteTree(); void bindKey(unsigned int key, unsigned int mod); - - std::string m_filename; - - class t_key { + + std::string m_filename; + + class t_key; + typedef std::vector keylist_t; + + class t_key { public: - t_key(unsigned int key, unsigned int mod, + t_key(unsigned int key, unsigned int mod, FbTk::RefCount command = FbTk::RefCount(0)); t_key(t_key *k); ~t_key(); - - inline t_key *find(unsigned int key_, unsigned int mod_) { + + t_key *find(unsigned int key_, unsigned int mod_) { for (size_t i = 0; i < keylist.size(); i++) { if (keylist[i]->key == key_ && keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(mod_)) - return keylist[i]; - } + return keylist[i]; + } return 0; } - inline t_key *find(XKeyEvent &ke) { + t_key *find(XKeyEvent &ke) { for (size_t i = 0; i < keylist.size(); i++) { - if (keylist[i]->key == ke.keycode && + if (keylist[i]->key == ke.keycode && keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) - return keylist[i]; - } + return keylist[i]; + } return 0; } - - inline bool operator == (XKeyEvent &ke) const { + + bool operator == (XKeyEvent &ke) const { return (mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state) && key == ke.keycode); } - + FbTk::RefCount m_command; unsigned int key; unsigned int mod; - std::vector keylist; + keylist_t keylist; }; /** @@ -117,7 +120,7 @@ private: */ bool mergeTree(t_key *newtree, t_key *basetree=0); - std::vector m_keylist; + keylist_t m_keylist; Display *m_display; ///< display connection unsigned int m_current_line; -- cgit v0.11.2