diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Keys.cc | 22 |
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 | } |