aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Keys.cc')
-rw-r--r--src/Keys.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index eb51f9a..b1f6763 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -89,7 +89,11 @@
89#include <map> 89#include <map>
90#include <memory> 90#include <memory>
91 91
92using namespace std; 92using std::cerr;
93using std::endl;
94using std::string;
95using std::vector;
96using std::ifstream;
93 97
94Keys::Keys(): 98Keys::Keys():
95 m_display(FbTk::App::instance()->display()) 99 m_display(FbTk::App::instance()->display())
@@ -171,7 +175,7 @@ bool Keys::save(const char *filename) const {
171 // return true; 175 // return true;
172} 176}
173 177
174bool Keys::addBinding(const std::string &linebuffer) { 178bool Keys::addBinding(const string &linebuffer) {
175 179
176 vector<string> val; 180 vector<string> val;
177 // Parse arguments 181 // Parse arguments
@@ -187,7 +191,7 @@ bool Keys::addBinding(const std::string &linebuffer) {
187 unsigned int key = 0, mod = 0; 191 unsigned int key = 0, mod = 0;
188 t_key *current_key=0, *last_key=0; 192 t_key *current_key=0, *last_key=0;
189 size_t argc = 0; 193 size_t argc = 0;
190 std::string keyMode = "default:"; 194 string keyMode = "default:";
191 195
192 if (val[0][val[0].length()-1] == ':') { 196 if (val[0][val[0].length()-1] == ':') {
193 argc++; 197 argc++;
@@ -213,21 +217,21 @@ bool Keys::addBinding(const std::string &linebuffer) {
213 // +[1-9] - number between +1 and +9 217 // +[1-9] - number between +1 and +9
214 // numbers 10 and above 218 // numbers 10 and above
215 // 219 //
216 if (val[argc].size() > 1 && (isdigit(val[argc][0]) && 220 if (val[argc].size() > 1 && (isdigit(val[argc][0]) &&
217 (isdigit(val[argc][1]) || val[argc][1] == 'x') || 221 (isdigit(val[argc][1]) || val[argc][1] == 'x') ||
218 val[argc][0] == '+' && isdigit(val[argc][1])) ) { 222 val[argc][0] == '+' && isdigit(val[argc][1])) ) {
219 223
220 key = strtoul(val[argc].c_str(), NULL, 0); 224 key = strtoul(val[argc].c_str(), NULL, 0);
221 225
222 if (errno == EINVAL || errno == ERANGE) 226 if (errno == EINVAL || errno == ERANGE)
223 key = 0; 227 key = 0;
224 228
225 } else // convert from string symbol 229 } else // convert from string symbol
226 key = FbTk::KeyUtil::getKey(val[argc].c_str()); 230 key = FbTk::KeyUtil::getKey(val[argc].c_str());
227 231
228 if (key == 0) { 232 if (key == 0) {
229 cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod, 233 cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod,
230 "Keys: Invalid key/modifier on line", 234 "Keys: Invalid key/modifier on line",
231 "A bad key/modifier string was found on line (number following)")<<" "<< 235 "A bad key/modifier string was found on line (number following)")<<" "<<
232 m_current_line<<"): "<<linebuffer<<endl; 236 m_current_line<<"): "<<linebuffer<<endl;
233 return false; 237 return false;
@@ -391,7 +395,7 @@ bool Keys::mergeTree(t_key *newtree, t_key *basetree) {
391 return false; 395 return false;
392} 396}
393 397
394void Keys::keyMode(std::string keyMode = "default") { 398void Keys::keyMode(string keyMode = "default") {
395 keyspace_t::iterator it = m_map.find(keyMode + ":"); 399 keyspace_t::iterator it = m_map.find(keyMode + ":");
396 if (it == m_map.end()) 400 if (it == m_map.end())
397 m_keylist = m_map["default:"]; 401 m_keylist = m_map["default:"];