aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathias <mathias>2006-04-11 19:22:24 (GMT)
committermathias <mathias>2006-04-11 19:22:24 (GMT)
commitbe03b0a3dc916cd9a320a41e38ab57555f8d2a94 (patch)
treeb3a16984599e9f5e642dac132a1ed9076684fcb7 /src
parenta6551852bb5cc860c2ba62b4b70ec269dcd9eb40 (diff)
downloadfluxbox_paul-be03b0a3dc916cd9a320a41e38ab57555f8d2a94.zip
fluxbox_paul-be03b0a3dc916cd9a320a41e38ab57555f8d2a94.tar.bz2
cosmetic, closes #1467926
Diffstat (limited to 'src')
-rw-r--r--src/Keys.cc10
-rw-r--r--src/Keys.hh39
2 files changed, 26 insertions, 23 deletions
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
113void Keys::deleteTree() { 113void 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;