Commit f7b08468 authored by kernc's avatar kernc

Fixed some IF conditions regarding --export-keymap switch.

git-svn-id: https://logkeys.googlecode.com/svn/trunk@71 c501e62c-e7d1-11de-a198-37193048d1ed
parent c0435b7e
...@@ -56,7 +56,7 @@ inline bool is_used_key(unsigned int code) ...@@ -56,7 +56,7 @@ inline bool is_used_key(unsigned int code)
return (char_or_func[code] != '_'); return (char_or_func[code] != '_');
} }
// translates character keycodes to continuous array indices // translates character keycodes to continuous array indexes
inline int to_char_keys_index(unsigned int keycode) inline int to_char_keys_index(unsigned int keycode)
{ {
if (keycode >= KEY_1 && keycode <= KEY_EQUAL) // keycodes 2-13: US keyboard: 1, 2, ..., 0, -, = if (keycode >= KEY_1 && keycode <= KEY_EQUAL) // keycodes 2-13: US keyboard: 1, 2, ..., 0, -, =
...@@ -73,7 +73,7 @@ inline int to_char_keys_index(unsigned int keycode) ...@@ -73,7 +73,7 @@ inline int to_char_keys_index(unsigned int keycode)
return -1; // not character keycode return -1; // not character keycode
} }
// translates function keys keycodes to continuous array indices // translates function keys keycodes to continuous array indexes
inline int to_func_keys_index(unsigned int keycode) inline int to_func_keys_index(unsigned int keycode)
{ {
if (keycode == KEY_ESC) // 1 if (keycode == KEY_ESC) // 1
......
...@@ -377,23 +377,23 @@ int main(int argc, char **argv) ...@@ -377,23 +377,23 @@ int main(int argc, char **argv)
} }
// check for incompatible flags // check for incompatible flags
if (args.keymap && args.us_keymap) { if (args.keymap && (!(args.flags & FLAG_EXPORT_KEYMAP) && args.us_keymap)) { // exporting uses args.keymap also
error(EXIT_FAILURE, 0, "Incompatible flags '-m' and '-u'. See usage."); error(EXIT_FAILURE, 0, "Incompatible flags '-m' and '-u'. See usage.");
} }
set_utf8_locale(); set_utf8_locale();
if (args.start && args.keymap && !(args.flags & FLAG_EXPORT_KEYMAP)) { if (args.flags & FLAG_EXPORT_KEYMAP) {
// read keymap from file if (!args.us_keymap)
parse_input_keymap();
}
else if ((args.start && !args.us_keymap) || (args.flags & FLAG_EXPORT_KEYMAP)) {
// get keymap used by the system and optionally export it to file
determine_system_keymap(); determine_system_keymap();
export_keymap_to_file();
// export keymap if so requested // = exit(0)
if ((args.flags & FLAG_EXPORT_KEYMAP)) export_keymap_to_file();
} }
else if (args.keymap) // custom keymap in use
parse_input_keymap();
else
determine_system_keymap();
if (args.device == NULL) { // no device given with -d switch if (args.device == NULL) { // no device given with -d switch
determine_input_device(); determine_input_device();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment