aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-05-20 22:25:22 (GMT)
committerfluxgen <fluxgen>2005-05-20 22:25:22 (GMT)
commitf9af363e24b18510554c54950ce1f5d142419c0c (patch)
treecfa8260a07ff4e7ee89e4225a4630d8fccca2481 /src/Keys.cc
parent3172279d104738a72352739c07bf658aa0324d03 (diff)
downloadfluxbox_pavel-f9af363e24b18510554c54950ce1f5d142419c0c.zip
fluxbox_pavel-f9af363e24b18510554c54950ce1f5d142419c0c.tar.bz2
added the ability to use keycode in keys file
Diffstat (limited to 'src/Keys.cc')
-rw-r--r--src/Keys.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 0d3eecd..e817374 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -201,9 +201,27 @@ bool Keys::addBinding(const std::string &linebuffer) {
201 if(tmpmod) 201 if(tmpmod)
202 mod |= tmpmod; //If it's a modifier 202 mod |= tmpmod; //If it's a modifier
203 else { 203 else {
204 key = FbTk::KeyUtil::getKey(val[argc].c_str()); // else get the key 204 // keycode covers the following three two-byte cases:
205 // 0x - hex
206 // +[1-9] - number between +1 and +9
207 // numbers 10 and above
208 //
209 if (val[argc].size() > 1 && (isdigit(val[argc][0]) &&
210 (isdigit(val[argc][1]) || val[argc][1] == 'x') ||
211 val[argc][0] == '+' && isdigit(val[argc][1])) ) {
212
213 key = strtoul(val[argc].c_str(), NULL, 0);
214
215 if (errno == EINVAL || errno == ERANGE)
216 key = 0;
217
218 } else // convert from string symbol
219 key = FbTk::KeyUtil::getKey(val[argc].c_str());
220
205 if (key == 0) { 221 if (key == 0) {
206 cerr<<_FBTEXT(Keys, InvalidKeyMod, "Keys: Invalid key/modifier on line", "A bad key/modifier string was found on line (number following)")<<" "<< 222 cerr<<_FBTEXT(Keys, InvalidKeyMod,
223 "Keys: Invalid key/modifier on line",
224 "A bad key/modifier string was found on line (number following)")<<" "<<
207 m_current_line<<"): "<<linebuffer<<endl; 225 m_current_line<<"): "<<linebuffer<<endl;
208 return false; 226 return false;
209 } 227 }