diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/Keys.cc | 10 | ||||
-rw-r--r-- | src/Keys.hh | 39 |
3 files changed, 28 insertions, 23 deletions
@@ -3,6 +3,8 @@ Changes for 0.9.16: | |||
3 | *06/04/11: | 3 | *06/04/11: |
4 | * Fix calculation of prevWorkspace (Mathias) | 4 | * Fix calculation of prevWorkspace (Mathias) |
5 | Screen.cc | 5 | Screen.cc |
6 | * Cosmetic, close #1467926 (thanx Jonas Koelker) | ||
7 | Keys.hh/cc | ||
6 | *06/04/09: | 8 | *06/04/09: |
7 | * Fix label background update with external tabs (Simon) | 9 | * Fix label background update with external tabs (Simon) |
8 | FbWinFrame.cc | 10 | 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() { | |||
111 | 111 | ||
112 | /// Destroys the keytree | 112 | /// Destroys the keytree |
113 | void Keys::deleteTree() { | 113 | void Keys::deleteTree() { |
114 | while (!m_keylist.empty()) { | 114 | keylist_t::iterator it = m_keylist.begin(); |
115 | if (m_keylist.back()) | 115 | const keylist_t::iterator end = m_keylist.end(); |
116 | delete m_keylist.back(); | 116 | for ( ; it != end; it++) |
117 | m_keylist.pop_back(); | 117 | delete *it; |
118 | } | 118 | m_keylist.clear(); |
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
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: | |||
75 | void deleteTree(); | 75 | void deleteTree(); |
76 | 76 | ||
77 | void bindKey(unsigned int key, unsigned int mod); | 77 | void bindKey(unsigned int key, unsigned int mod); |
78 | 78 | ||
79 | std::string m_filename; | 79 | std::string m_filename; |
80 | 80 | ||
81 | class t_key { | 81 | class t_key; |
82 | typedef std::vector<t_key*> keylist_t; | ||
83 | |||
84 | class t_key { | ||
82 | public: | 85 | public: |
83 | t_key(unsigned int key, unsigned int mod, | 86 | t_key(unsigned int key, unsigned int mod, |
84 | FbTk::RefCount<FbTk::Command> command = FbTk::RefCount<FbTk::Command>(0)); | 87 | FbTk::RefCount<FbTk::Command> command = FbTk::RefCount<FbTk::Command>(0)); |
85 | t_key(t_key *k); | 88 | t_key(t_key *k); |
86 | ~t_key(); | 89 | ~t_key(); |
87 | 90 | ||
88 | inline t_key *find(unsigned int key_, unsigned int mod_) { | 91 | t_key *find(unsigned int key_, unsigned int mod_) { |
89 | for (size_t i = 0; i < keylist.size(); i++) { | 92 | for (size_t i = 0; i < keylist.size(); i++) { |
90 | if (keylist[i]->key == key_ && keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(mod_)) | 93 | if (keylist[i]->key == key_ && keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(mod_)) |
91 | return keylist[i]; | 94 | return keylist[i]; |
92 | } | 95 | } |
93 | return 0; | 96 | return 0; |
94 | } | 97 | } |
95 | inline t_key *find(XKeyEvent &ke) { | 98 | t_key *find(XKeyEvent &ke) { |
96 | for (size_t i = 0; i < keylist.size(); i++) { | 99 | for (size_t i = 0; i < keylist.size(); i++) { |
97 | if (keylist[i]->key == ke.keycode && | 100 | if (keylist[i]->key == ke.keycode && |
98 | keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) | 101 | keylist[i]->mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) |
99 | return keylist[i]; | 102 | return keylist[i]; |
100 | } | 103 | } |
101 | return 0; | 104 | return 0; |
102 | } | 105 | } |
103 | 106 | ||
104 | inline bool operator == (XKeyEvent &ke) const { | 107 | bool operator == (XKeyEvent &ke) const { |
105 | return (mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state) && key == ke.keycode); | 108 | return (mod == FbTk::KeyUtil::instance().isolateModifierMask(ke.state) && key == ke.keycode); |
106 | } | 109 | } |
107 | 110 | ||
108 | FbTk::RefCount<FbTk::Command> m_command; | 111 | FbTk::RefCount<FbTk::Command> m_command; |
109 | unsigned int key; | 112 | unsigned int key; |
110 | unsigned int mod; | 113 | unsigned int mod; |
111 | std::vector<t_key *> keylist; | 114 | keylist_t keylist; |
112 | }; | 115 | }; |
113 | 116 | ||
114 | /** | 117 | /** |
@@ -117,7 +120,7 @@ private: | |||
117 | */ | 120 | */ |
118 | bool mergeTree(t_key *newtree, t_key *basetree=0); | 121 | bool mergeTree(t_key *newtree, t_key *basetree=0); |
119 | 122 | ||
120 | std::vector<t_key *> m_keylist; | 123 | keylist_t m_keylist; |
121 | 124 | ||
122 | Display *m_display; ///< display connection | 125 | Display *m_display; ///< display connection |
123 | unsigned int m_current_line; | 126 | unsigned int m_current_line; |