diff --git a/src/add-ons/input_server/devices/keyboard/Keymap.cpp b/src/add-ons/input_server/devices/keyboard/Keymap.cpp index 6d6834322b..86afbe0178 100644 --- a/src/add-ons/input_server/devices/keyboard/Keymap.cpp +++ b/src/add-ons/input_server/devices/keyboard/Keymap.cpp @@ -30,12 +30,12 @@ print_key(char* chars, int32 offset) switch (size) { case 0: // Not mapped - printf("N/A"); + fputs("N/A", stdout); break; case 1: - // 1-byte UTF-8/ASCII character - printf("%c", chars[offset]); + // single-byte UTF-8/ASCII character + fputc(chars[offset], stdout); break; default: @@ -47,13 +47,13 @@ print_key(char* chars, int32 offset) strncpy(str, &(chars[offset]), size); str[size] = 0; - printf("%s", str); + fputs(str, stdout); delete [] str; break; } } - printf("\t"); + fputs("\t", stdout); } @@ -74,22 +74,25 @@ Keymap::~Keymap() void Keymap::DumpKeymap() { - // Print a chart of the normal, shift, option, and option+shift - // keys. - printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n"); + if (fKeys.version != 3) + return; - for (int i = 0; i < 128; i++) { - printf(" 0x%x\t", i); + // Print a chart of the normal, shift, control, option, option+shift, + // Caps, Caps+shift, Caps+option, and Caps+option+shift keys. + puts("Key #\tn\ts\tc\to\tos\tC\tCs\tCo\tCos\n"); + + for (uint8 i = 0; i < 128; i++) { + printf(" 0x%02x\t", i); print_key(fChars, fKeys.normal_map[i]); print_key(fChars, fKeys.shift_map[i]); - print_key(fChars, fKeys.caps_map[i]); - print_key(fChars, fKeys.caps_shift_map[i]); + print_key(fChars, fKeys.control_map[i]); print_key(fChars, fKeys.option_map[i]); print_key(fChars, fKeys.option_shift_map[i]); + print_key(fChars, fKeys.caps_map[i]); + print_key(fChars, fKeys.caps_shift_map[i]); print_key(fChars, fKeys.option_caps_map[i]); print_key(fChars, fKeys.option_caps_shift_map[i]); - print_key(fChars, fKeys.control_map[i]); - printf("\n"); + fputs("\n", stdout); } } diff --git a/src/bin/keymap/Keymap.cpp b/src/bin/keymap/Keymap.cpp index b7003661ed..29cc48ce5d 100644 --- a/src/bin/keymap/Keymap.cpp +++ b/src/bin/keymap/Keymap.cpp @@ -1,10 +1,11 @@ /* - * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Jérôme Duval * Axel Dörfler, axeld@pinc-software.de. + * John Scipione, jscipione@gmail.com */ @@ -69,7 +70,6 @@ const char keyPattern[] = "Key[[:space:]]+\\([[:alnum:]]+\\)[[:space:]]+=" "[[:space:]]+\\([[:alnum:]]+\\|'.*'\\)" "[[:space:]]+"; - const char acutePattern[] = "Acute[[:space:]]+\\([[:alnum:]]+\\|'.*'\\)" "[[:space:]]+=[[:space:]]+\\([[:alnum:]]+\\|'.*'\\)[[:space:]]+"; const char gravePattern[] = "Grave[[:space:]]+\\([[:alnum:]]+\\|'.*'\\)" @@ -163,24 +163,24 @@ struct re_pattern_buffer tildetabBuf; void dump_map(FILE* file, const char* name, int32* map) { - fprintf(file, "\t%s:{\n", name); + fprintf(file, "\t%s:\n\t{\n", name); for (uint32 i = 0; i < 16; i++) { - fprintf(file, "\t\t"); + fputs("\t\t", file); for (uint32 j = 0; j < 8; j++) { fprintf(file, "0x%04" B_PRIx32 ",%s", map[i * 8 + j], j < 7 ? " " : ""); } - fprintf(file, "\n"); + fputs("\n", file); } - fprintf(file, "\t},\n"); + fputs("\t},\n", file); } void dump_keys(FILE* file, const char* name, int32* keys) { - fprintf(file, "\t%s:{\n", name); + fprintf(file, "\t%s:\n\t{\n", name); for (uint32 i = 0; i < 4; i++) { fprintf(file, "\t\t"); @@ -188,9 +188,9 @@ dump_keys(FILE* file, const char* name, int32* keys) fprintf(file, "0x%04" B_PRIx32 ",%s", keys[i * 8 + j], j < 7 ? " " : ""); } - fprintf(file, "\n"); + fputs("\n", file); } - fprintf(file, "\t},\n"); + fputs("\t},\n", file); } @@ -229,99 +229,103 @@ Keymap::LoadSource(FILE* file) reg_syntax_t syntax = RE_CHAR_CLASSES; re_set_syntax(syntax); - const char* error = re_compile_pattern(versionPattern, - strlen(versionPattern), &versionBuf); + const char* error = NULL; + + error = re_compile_pattern(versionPattern, strlen(versionPattern), + &versionBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(capslockPattern, strlen(capslockPattern), &capslockBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(scrolllockPattern, strlen(scrolllockPattern), &scrolllockBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(numlockPattern, strlen(numlockPattern), &numlockBuf); if (error) - fprintf(stderr, error); - error = re_compile_pattern(lshiftPattern, strlen(lshiftPattern), &lshiftBuf); + fputs(error, stderr); + error = re_compile_pattern(lshiftPattern, strlen(lshiftPattern), + &lshiftBuf); if (error) - fprintf(stderr, error); - error = re_compile_pattern(rshiftPattern, strlen(rshiftPattern), &rshiftBuf); + fputs(error, stderr); + error = re_compile_pattern(rshiftPattern, strlen(rshiftPattern), + &rshiftBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(lcommandPattern, strlen(lcommandPattern), &lcommandBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(rcommandPattern, strlen(rcommandPattern), &rcommandBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(lcontrolPattern, strlen(lcontrolPattern), &lcontrolBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(rcontrolPattern, strlen(rcontrolPattern), &rcontrolBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(loptionPattern, strlen(loptionPattern), &loptionBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(roptionPattern, strlen(roptionPattern), &roptionBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(menuPattern, strlen(menuPattern), &menuBuf); if (error) - fprintf(stderr, error); - error = re_compile_pattern(locksettingsPattern, strlen(locksettingsPattern), - &locksettingsBuf); + fputs(error, stderr); + error = re_compile_pattern(locksettingsPattern, + strlen(locksettingsPattern), &locksettingsBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(keyPattern, strlen(keyPattern), &keyBuf); - if (error) - fprintf(stderr, error); + if (error) + fputs(error, stderr); error = re_compile_pattern(acutePattern, strlen(acutePattern), ´Buf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(gravePattern, strlen(gravePattern), &graveBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(circumflexPattern, strlen(circumflexPattern), &circumflexBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(diaeresisPattern, strlen(diaeresisPattern), &diaeresisBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(tildePattern, strlen(tildePattern), &tildeBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(acutetabPattern, strlen(acutetabPattern), ´tabBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(gravetabPattern, strlen(gravetabPattern), &gravetabBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(circumflextabPattern, strlen(circumflextabPattern), &circumflextabBuf); if (error) - fprintf(stderr, error); - error = re_compile_pattern(diaeresistabPattern, strlen(diaeresistabPattern), - &diaeresistabBuf); + fputs(error, stderr); + error = re_compile_pattern(diaeresistabPattern, + strlen(diaeresistabPattern), &diaeresistabBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); error = re_compile_pattern(tildetabPattern, strlen(tildetabPattern), &tildetabBuf); if (error) - fprintf(stderr, error); + fputs(error, stderr); // Read file @@ -356,6 +360,7 @@ Keymap::LoadSource(FILE* file) size_t length = strlen(buffer); struct re_registers regs; + if (re_search(&versionBuf, buffer, length, 0, length, ®s) >= 0) { sscanf(buffer + regs.start[1], "%" B_SCNu32, &fKeys.version); } else if (re_search(&capslockBuf, buffer, length, 0, length, ®s) @@ -399,7 +404,8 @@ Keymap::LoadSource(FILE* file) >= 0) { sscanf(buffer + regs.start[1], "0x%" B_SCNx32, &fKeys.right_option_key); - } else if (re_search(&menuBuf, buffer, length, 0, length, ®s) >= 0) { + } else if (re_search(&menuBuf, buffer, length, 0, length, ®s) + >= 0) { sscanf(buffer + regs.start[1], "0x%" B_SCNx32, &fKeys.menu_key); } else if (re_search(&locksettingsBuf, buffer, length, 0, length, ®s) >= 0) { @@ -417,7 +423,8 @@ Keymap::LoadSource(FILE* file) else if (!strncmp(start, "ScrollLock", length)) fKeys.lock_settings |= B_SCROLL_LOCK; } - } else if (re_search(&keyBuf, buffer, length, 0, length, ®s) >= 0) { + } else if (re_search(&keyBuf, buffer, length, 0, length, ®s) + >= 0) { uint32 keyCode; if (sscanf(buffer + regs.start[1], "0x%" B_SCNx32, &keyCode) > 0) { for (int i = 2; i <= 10; i++) { @@ -425,12 +432,14 @@ Keymap::LoadSource(FILE* file) _ComputeChars(buffer, regs, i, offset); } } - } else if (re_search(´Buf, buffer, length, 0, length, ®s) >= 0) { + } else if (re_search(´Buf, buffer, length, 0, length, ®s) + >= 0) { for (int i = 1; i <= 2; i++) { fKeys.acute_dead_key[acuteOffset++] = offset; _ComputeChars(buffer, regs, i, offset); } - } else if (re_search(&graveBuf, buffer, length, 0, length, ®s) >= 0) { + } else if (re_search(&graveBuf, buffer, length, 0, length, ®s) + >= 0) { for (int i = 1; i <= 2; i++) { fKeys.grave_dead_key[graveOffset++] = offset; _ComputeChars(buffer, regs, i, offset); @@ -613,13 +622,20 @@ Keymap::SaveAsCppHeader(const char* fileName, const char* mapName) if (file == NULL) return errno; - fprintf(file, "/*\n" - " * Haiku Keymap\n" - " * This file is generated automatically. Don't edit!\n" - " */\n\n"); - fprintf(file, "#include \n\n"); + fputs("/*\n" + " * Haiku Default System Keymap\n" + " * This file is automatically generated. Do not edit!\n" + " */\n", file); + fputs("#ifndef\t_SYSTEM_KEYMAP_H\n" + "#define\t_SYSTEM_KEYMAP_H\n\n\n", file); + fputs("#include \n\n\n", file); + fputs("#ifdef __cplusplus\n" + "extern \"C\" {\n" + "#endif\n\n", file); fprintf(file, "const char *kSystemKeymapName = \"%s\";\n\n", name.String()); - fprintf(file, "const key_map kSystemKeymap = {\n"); + fputs("const key_map kSystemKeymap = {\n", file); + + // version, default lock settings, modifier keys fprintf(file, "\tversion:%" B_PRIu32 ",\n", fKeys.version); fprintf(file, "\tcaps_key:0x%" B_PRIx32 ",\n", fKeys.caps_key); fprintf(file, "\tscroll_key:0x%" B_PRIx32 ",\n", fKeys.scroll_key); @@ -642,6 +658,7 @@ Keymap::SaveAsCppHeader(const char* fileName, const char* mapName) fprintf(file, "\tmenu_key:0x%" B_PRIx32 ",\n", fKeys.menu_key); fprintf(file, "\tlock_settings:0x%" B_PRIx32 ",\n", fKeys.lock_settings); + // maps dump_map(file, "control_map", fKeys.control_map); dump_map(file, "option_caps_shift_map", fKeys.option_caps_shift_map); dump_map(file, "option_caps_map", fKeys.option_caps_map); @@ -652,13 +669,14 @@ Keymap::SaveAsCppHeader(const char* fileName, const char* mapName) dump_map(file, "shift_map", fKeys.shift_map); dump_map(file, "normal_map", fKeys.normal_map); + // dead keys dump_keys(file, "acute_dead_key", fKeys.acute_dead_key); dump_keys(file, "grave_dead_key", fKeys.grave_dead_key); - dump_keys(file, "circumflex_dead_key", fKeys.circumflex_dead_key); dump_keys(file, "dieresis_dead_key", fKeys.dieresis_dead_key); dump_keys(file, "tilde_dead_key", fKeys.tilde_dead_key); + // dead key tables fprintf(file, "\tacute_tables:0x%" B_PRIx32 ",\n", fKeys.acute_tables); fprintf(file, "\tgrave_tables:0x%" B_PRIx32 ",\n", fKeys.grave_tables); fprintf(file, "\tcircumflex_tables:0x%" B_PRIx32 ",\n", @@ -667,23 +685,29 @@ Keymap::SaveAsCppHeader(const char* fileName, const char* mapName) fKeys.dieresis_tables); fprintf(file, "\ttilde_tables:0x%" B_PRIx32 ",\n", fKeys.tilde_tables); - fprintf(file, "};\n\n"); + fputs("};\n\n", file); + + fputs("const char kSystemKeyChars[] = {\n", file); - fprintf(file, "const char kSystemKeyChars[] = {\n"); for (uint32 i = 0; i < fCharsSize; i++) { if (i % 10 == 0) { if (i > 0) - fprintf(file, "\n"); - fprintf(file, "\t"); + fputs("\n", file); + fputs("\t", file); } else - fprintf(file, " "); + fputs(" ", file); fprintf(file, "0x%02x,", (uint8)fChars[i]); } - fprintf(file, "\n};\n\n"); + fputs("\n};\n\n", file); - fprintf(file, "const uint32 kSystemKeyCharsSize = %" B_PRIu32 ";\n", + fprintf(file, "const uint32 kSystemKeyCharsSize = %" B_PRIu32 ";\n\n", fCharsSize); + fputs("#ifdef __cplusplus\n" + "}\n" + "#endif\n\n" + "#endif\t// _SYSTEM_KEYMAP_H\n", file); + fclose(file); return B_OK; @@ -742,7 +766,7 @@ Keymap::GetKey(const char* chars, int32 offset, char* buffer, size_t bufferSize) return false; case 1: - // 1-byte UTF-8/ASCII character + // single-byte UTF-8/ASCII character if ((uint8)chars[offset] < 0x20 || (uint8)chars[offset] > 0x7e) sprintf(string, "0x%02x", (uint8)chars[offset]); else { @@ -869,8 +893,9 @@ Keymap::_SaveSourceText(FILE* file) "ROption = 0x%02" B_PRIx32 "\n" "Menu = 0x%02" B_PRIx32 "\n", fKeys.version, fKeys.caps_key, fKeys.scroll_key, fKeys.num_key, - fKeys.left_shift_key, fKeys.right_shift_key, fKeys.left_command_key, - fKeys.right_command_key, fKeys.left_control_key, fKeys.right_control_key, + fKeys.left_shift_key, fKeys.right_shift_key, + fKeys.left_command_key, fKeys.right_command_key, + fKeys.left_control_key, fKeys.right_control_key, fKeys.left_option_key, fKeys.right_option_key, fKeys.menu_key); #if (defined(__BEOS__) || defined(__HAIKU__)) @@ -915,13 +940,15 @@ Keymap::_SaveSourceText(FILE* file) } #endif - bytes += fprintf(file, "# Legend:\n" + bytes += fputs("# Legend:\n" "# n = Normal\n" "# s = Shift\n" "# c = Control\n" "# C = CapsLock\n" "# o = Option\n" - "# Key n s c o os C Cs Co Cos \n"); + "# Key n s c o os " + "C Cs Co Cos \n", file); + #if (defined(__BEOS__) || defined(__HAIKU__)) if (runs != NULL) { @@ -952,9 +979,10 @@ Keymap::_SaveSourceText(FILE* file) GetKey(fChars, fKeys.option_caps_map[i], optionCapsKey, 32); GetKey(fChars, fKeys.option_caps_shift_map[i], optionCapsShiftKey, 32); - fprintf(file, "Key 0x%02x = %-9s%-9s%-9s%-9s%-9s%-9s%-9s%-9s%-9s\n", i, - normalKey, shiftKey, controlKey, optionKey, optionShiftKey, capsKey, - capsShiftKey, optionCapsKey, optionCapsShiftKey); + fprintf(file, + "Key 0x%02x = %-9s%-9s%-9s%-9s%-9s%-9s%-9s%-9s%-9s\n", i, + normalKey, shiftKey, controlKey, optionKey, optionShiftKey, + capsKey, capsShiftKey, optionCapsKey, optionCapsShiftKey); } int32* deadOffsets[] = { @@ -994,25 +1022,25 @@ Keymap::_SaveSourceText(FILE* file) fprintf(file, "%sTab = ", labels[i]); - if (deadTables[i] & B_NORMAL_TABLE) - fprintf(file, "Normal "); - if (deadTables[i] & B_SHIFT_TABLE) - fprintf(file, "Shift "); - if (deadTables[i] & B_CONTROL_TABLE) - fprintf(file, "Control "); - if (deadTables[i] & B_OPTION_TABLE) - fprintf(file, "Option "); - if (deadTables[i] & B_OPTION_SHIFT_TABLE) - fprintf(file, "Option-Shift "); - if (deadTables[i] & B_CAPS_TABLE) - fprintf(file, "CapsLock "); - if (deadTables[i] & B_CAPS_SHIFT_TABLE) - fprintf(file, "CapsLock-Shift "); - if (deadTables[i] & B_OPTION_CAPS_TABLE) - fprintf(file, "CapsLock-Option "); - if (deadTables[i] & B_OPTION_CAPS_SHIFT_TABLE) - fprintf(file, "CapsLock-Option-Shift "); - fprintf(file, "\n"); + if ((deadTables[i] & B_NORMAL_TABLE) != 0) + fputs("Normal ", file); + if ((deadTables[i] & B_SHIFT_TABLE) != 0) + fputs("Shift ", file); + if ((deadTables[i] & B_CONTROL_TABLE) != 0) + fputs("Control ", file); + if ((deadTables[i] & B_OPTION_TABLE) != 0) + fputs("Option ", file); + if ((deadTables[i] & B_OPTION_SHIFT_TABLE) != 0) + fputs("Option-Shift ", file); + if ((deadTables[i] & B_CAPS_TABLE) != 0) + fputs("CapsLock ", file); + if ((deadTables[i] & B_CAPS_SHIFT_TABLE) != 0) + fputs("CapsLock-Shift ", file); + if ((deadTables[i] & B_OPTION_CAPS_TABLE) != 0) + fputs("CapsLock-Option ", file); + if ((deadTables[i] & B_OPTION_CAPS_SHIFT_TABLE) != 0) + fputs("CapsLock-Option-Shift ", file); + fputs("\n", file); } } @@ -1025,9 +1053,10 @@ Keymap::_ComputeChars(const char* buffer, struct re_registers& regs, int i, char hexChars[12]; uint32 length = 0; - if (strncmp(buffer + regs.start[i], "''", regs.end[i] - regs.start[i]) == 0) + if (strncmp(buffer + regs.start[i], "''", regs.end[i] - regs.start[i]) + == 0) { length = 0; - else if (sscanf(buffer + regs.start[i], "'%s'", current) > 0) { + } else if (sscanf(buffer + regs.start[i], "'%s'", current) > 0) { if (current[0] == '\\') current[0] = current[1]; else if (current[0] == '\'') diff --git a/src/data/keymaps/US-International.keymap b/src/data/keymaps/US-International.keymap index 9d76fd4f80..737d3279d8 100644 --- a/src/data/keymaps/US-International.keymap +++ b/src/data/keymaps/US-International.keymap @@ -1,25 +1,25 @@ -#!/bin/keymap -l +#!/bin/keymap -s # -# Raw key numbering for 101 keyboard... -# [sys] [brk] -# 0x7e 0x7f -# [esc] [ f1] [ f2] [ f3] [ f4] [ f5] [ f6] [ f7] [ f8] [ f9] [f10] [f11] [f12] [prn] [scr] [pau] -# 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 K E Y P A D K E Y S +# Raw key numbering for 102-key keyboard... +# [sys] [brk] +# 0x7e 0x7f +# [esc] [ f1] [ f2] [ f3] [ f4] [ f5] [ f6] [ f7] [ f8] [ f9] [f10] [f11] [f12] [prn] [scr] [pau] +# 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 K E Y P A D K E Y S # -# [ ` ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ] [bck] [ins] [hme] [pup] [num] [ / ] [ * ] [ - ] -# 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 +# [ ` ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ] [ bck ] [ins] [hme] [pup] [num] [ / ] [ * ] [ - ] +# 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 # -# [tab] [ q ] [ w ] [ e ] [ r ] [ t ] [ y ] [ u ] [ i ] [ o ] [ p ] [ [ ] [ ] ] [ \ ] [del] [end] [pdn] [ 7 ] [ 8 ] [ 9 ] [ + ] -# 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a +# [ tab ] [ q ] [ w ] [ e ] [ r ] [ t ] [ y ] [ u ] [ i ] [ o ] [ p ] [ [ ] [ ] ] [ \ ] [del] [end] [pdn] [ 7 ] [ 8 ] [ 9 ] [ + ] +# 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a # -# [cap] [ a ] [ s ] [ d ] [ f ] [ g ] [ h ] [ j ] [ k ] [ l ] [ ; ] [ ' ] [ enter ] [ 4 ] [ 5 ] [ 6 ] -# 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a +# [ caps ] [ a ] [ s ] [ d ] [ f ] [ g ] [ h ] [ j ] [ k ] [ l ] [ ; ] [ ' ] [ enter ] [ 4 ] [ 5 ] [ 6 ] +# 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a # -# [shift] [ z ] [ x ] [ c ] [ v ] [ b ] [ n ] [ m ] [ , ] [ . ] [ / ] [shift] [ up] [ 1 ] [ 2 ] [ 3 ] [ent] -# 0x4b 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b +# [shft] [ \ ] [ z ] [ x ] [ c ] [ v ] [ b ] [ n ] [ m ] [ , ] [ . ] [ / ] [ shift ] [ up] [ 1 ] [ 2 ] [ 3 ] [ent] +# 0x4b 0x69 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b # -# [ctr] [cmd] [ space ] [cmd] [ctr] [lft] [dwn] [rgt] [ 0 ] [ . ] -# 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 +# [ ctrl ] [ cmd ] [ space ] [ cmd ] [ ctrl ] [lft] [dwn] [rgt] [ 0 ] [ . ] +# 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 # # NOTE: On a Microsoft Natural Keyboard: # left option = 0x66 @@ -37,7 +37,7 @@ NumLock = 0x22 LShift = 0x4b RShift = 0x56 LCommand = 0x5d -RCommand = 0x05f +RCommand = 0x5f LControl = 0x5c RControl = 0x60 LOption = 0x66 @@ -58,7 +58,7 @@ LockSettings = # c = Control # C = CapsLock # o = Option -# Key n s c o os C Cs Co Cos +# Key n s c o os C Cs Co Cos Key 0x00 = '' '' '' '' '' '' '' '' '' Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 @@ -76,19 +76,19 @@ Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x11 = '`' '~' '' '`' '' '`' '~' ' ' '`' -Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2a1 0xc2b9 -Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2b2 0xc2ba -Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2b3 0xc2aa -Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a4 0xc2a3 -Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' 0xe282ac '' -Key 0x17 = '6' '^' 0x1e 0xc2bc '' '6' '^' 0xc2bc '' -Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' 0xc2bd '' -Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' 0xc2be '' -Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' 0xe28098 '' -Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xe28099 0xc2b1 -Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2a5 0xc2af -Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc397 0xc3b7 +Key 0x11 = '`' '~' '' '`' '~' '`' '~' '`' '~' +Key 0x12 = '1' '!' '' 0xc2a1 0xc2b9 '1' '!' 0xc2b9 0xc2a1 +Key 0x13 = '2' '@' 0x00 0xc2b2 0xc2ba '2' '@' 0xc2ba 0xc2b2 +Key 0x14 = '3' '#' '' 0xc2b3 0xc2aa '3' '#' 0xc2aa 0xc2b3 +Key 0x15 = '4' '$' '' 0xc2a4 0xc2a3 '4' '$' 0xc2a3 0xc2a4 +Key 0x16 = '5' '%' '' 0xe282ac '' '5' '%' '' 0xe282ac +Key 0x17 = '6' '^' 0x1e 0xc2bc '^' '6' '^' 0xc2bc '^' +Key 0x18 = '7' '&' '' 0xc2bd '' '7' '&' '' 0xc2bd +Key 0x19 = '8' '*' '' 0xc2be '' '8' '*' '' 0xc2be +Key 0x1a = '9' '(' '' 0xe28098 '' '9' '(' '' 0xe28098 +Key 0x1b = '0' ')' '' 0xe28099 0xc2b1 '0' ')' 0xc2b1 0xe28099 +Key 0x1c = '-' '_' 0x1f 0xc2a5 0xc2af '-' '_' 0xc2af 0xc2a5 +Key 0x1d = '=' '+' '' 0xc397 0xc3b7 '=' '+' 0xc3b7 0xc397 Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 @@ -98,73 +98,73 @@ Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 -Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' 'q' 0xc384 0xc3a4 -Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' 'w' 0xc385 0xc3a5 -Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' 'e' 0xc389 0xc3a9 -Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' 'r' 0xc2ae '' -Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' 't' 0xc39e 0xc3be -Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' 'y' 0xc39c 0xc3bc -Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' 'u' 0xc39a 0xc3ba -Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' 'i' 0xc38d 0xc3ad -Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' 'o' 0xc393 0xc3b3 -Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' 'p' 0xc396 0xc3b6 -Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '{' 0xc2ab '' -Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '}' 0xc2bb '' -Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2ac 0xc2a6 +Key 0x27 = 'q' 'Q' 0x11 0xc3a4 0xc384 'Q' '' 0xc384 0xc3a4 +Key 0x28 = 'w' 'W' 0x17 0xc3a5 0xc385 'W' '' 0xc385 0xc3a5 +Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' '' 0xc389 0xc3a9 +Key 0x2a = 'r' 'R' 0x12 0xc2ae '' 'R' '' '' 0xc2ae +Key 0x2b = 't' 'T' 0x14 0xc3be 0xc39e 'T' '' 0xc39e 0xc3be +Key 0x2c = 'y' 'Y' 0x19 0xc3bc 0xc39c 'Y' '' 0xc39c 0xc3bc +Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' '' 0xc39a 0xc3ba +Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' '' 0xc38d 0xc3ad +Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' '' 0xc393 0xc3b3 +Key 0x30 = 'p' 'P' 0x10 0xc3b6 0xc396 'P' '' 0xc396 0xc3b6 +Key 0x31 = '[' '{' 0x1b 0xc2ab '' '[' '' '' 0xc2ab +Key 0x32 = ']' '}' 0x1d 0xc2bb '' ']' '' '' 0xc2bb +Key 0x33 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '' 0xc2a6 0xc2ac Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c -Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' 0x01 '7' -Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' 0x1e '8' -Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' 0x0b '9' +Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01 +Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e +Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' Key 0x3b = '' '' '' '' '' '' '' '' '' -Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' 'a' 0xc381 0xc3a1 -Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' 's' 0xc39f 0xc2a7 -Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' 'd' 0xc390 0xc3b0 -Key 0x3f = 'f' 'F' 0x06 ' ' '' 'F' 'f' ' ' '' -Key 0x40 = 'g' 'G' 0x07 ' ' '' 'G' 'g' ' ' '' -Key 0x41 = 'h' 'H' 0x08 ' ' '' 'H' 'h' ' ' '' -Key 0x42 = 'j' 'J' 0x0a ' ' '' 'J' 'j' ' ' '' -Key 0x43 = 'k' 'K' 0x0b ' ' '' 'K' 'k' ' ' '' -Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' 'l' 0xc398 0xc3b8 -Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' ':' 0xc2b6 0xc2b0 -Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '"' 0xc2b4 0xc2a8 +Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' '' 0xc381 0xc3a1 +Key 0x3d = 's' 'S' 0x13 0xc39f 0xc2a7 'S' '' 0xc2a7 0xc39f +Key 0x3e = 'd' 'D' 0x04 0xc3b0 0xc390 'D' '' 0xc390 0xc3b0 +Key 0x3f = 'f' 'F' 0x06 '' '' 'F' '' '' '' +Key 0x40 = 'g' 'G' 0x07 '' '' 'G' '' '' '' +Key 0x41 = 'h' 'H' 0x08 '' '' 'H' '' '' '' +Key 0x42 = 'j' 'J' 0x0a '' '' 'J' '' '' '' +Key 0x43 = 'k' 'K' 0x0b '' '' 'K' '' '' '' +Key 0x44 = 'l' 'L' 0x0c 0xc3b8 0xc398 'L' '' 0xc398 0xc3b8 +Key 0x45 = ';' ':' '' 0xc2b6 0xc2b0 ';' '' 0xc2b0 0xc2b6 +Key 0x46 = '\'' '"' '' 0xc2b4 0xc2a8 '\'' '' 0xc2b4 0xc2a8 Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a -Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' 0x1c '4' -Key 0x49 = '' '5' '' '' '5' '' '5' '' '5' -Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' 0x1d '6' +Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c +Key 0x49 = '' '5' '' '' '5' '' '5' '5' '' +Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d Key 0x4b = '' '' '' '' '' '' '' '' '' -Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' 'z' 0xc386 0xc3a6 -Key 0x4d = 'x' 'X' 0x18 ' ' '' 'X' 'x' ' ' '' -Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' 'c' 0xc2a9 0xc2a2 -Key 0x4f = 'v' 'V' 0x16 ' ' '' 'V' 'v' ' ' '' -Key 0x50 = 'b' 'B' 0x02 ' ' '' 'B' 'b' ' ' '' -Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' 'n' 0xc391 0xc3b1 -Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' 'm' 0xc2b5 '' -Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '<' 0xc387 0xc3a7 -Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '>' 0xc2b7 0xc2b8 -Key 0x55 = '/' '?' '' 0xc2bf '' '/' '?' 0xc2bf '' +Key 0x4c = 'z' 'Z' 0x1a 0xc3a6 0xc386 'Z' '' 0xc386 0xc3a6 +Key 0x4d = 'x' 'X' 0x18 '' '' 'X' '' '' '' +Key 0x4e = 'c' 'C' 0x03 0xc2a9 0xc2a2 'C' '' 0xc2a9 0xc2a2 +Key 0x4f = 'v' 'V' 0x16 0xe2889a '' 'V' '' '' 0xe2889a +Key 0x50 = 'b' 'B' 0x02 '' '' 'B' '' '' '' +Key 0x51 = 'n' 'N' 0x0e 0xc3b1 0xc391 'N' '' 0xc391 0xc3b1 +Key 0x52 = 'm' 'M' 0x0d 0xc2b5 '' 'M' '' '' 0xc2b5 +Key 0x53 = ',' '<' '' 0xc3a7 0xc387 ',' '' 0xc387 0xc3a7 +Key 0x54 = '.' '>' '' 0xc2b7 0xc2b8 '.' '' 0xc2b8 0xc2b7 +Key 0x55 = '/' '?' '' '' '' '/' '' '' '' Key 0x56 = '' '' '' '' '' '' '' '' '' Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e -Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' 0x04 '1' -Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' 0x1f '2' -Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' 0x0c '3' +Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04 +Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f +Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a Key 0x5c = '' '' '' '' '' '' '' '' '' Key 0x5d = '' '' '' '' '' '' '' '' '' -Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' ' ' '' +Key 0x5e = ' ' ' ' 0x00 ' ' '' ' ' ' ' '' ' ' Key 0x5f = '' '' '' '' '' '' '' '' '' Key 0x60 = '' '' '' '' '' '' '' '' '' Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d -Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' 0x05 '0' -Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' 0x7f '.' +Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05 +Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f Key 0x66 = '' '' '' '' '' '' '' '' '' Key 0x67 = '' '' '' '' '' '' '' '' '' Key 0x68 = '' '' '' '' '' '' '' '' '' -Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2ac 0xc2a6 +Key 0x69 = '\\' '|' 0x1c 0xc2ac 0xc2a6 '\\' '|' 0xc2a6 0xc2ac Key 0x6a = '' '' '' '' '' '' '' '' '' Key 0x6b = '' '' '' '' '' '' '' '' '' Key 0x6c = '' '' '' '' '' '' '' '' '' @@ -187,7 +187,7 @@ Key 0x7c = '' '' '' '' '' '' '' '' Key 0x7d = '' '' '' '' '' '' '' '' '' Key 0x7e = '' '' '' '' '' '' '' '' '' Key 0x7f = '' '' '' '' '' '' '' '' '' -Acute ' ' = 0xc2b4 +Acute ' ' = 0xc2b4 Acute 'A' = 0xc381 Acute 'C' = 0xc387 Acute 'E' = 0xc389 @@ -202,7 +202,8 @@ Acute 'i' = 0xc3ad Acute 'o' = 0xc3b3 Acute 'u' = 0xc3ba Acute 'y' = 0xc3bd -AcuteTab = Option CapsLock-Option +Acute '' = '' +AcuteTab = Option CapsLock-Option Grave ' ' = '`' Grave 'A' = 0xc380 Grave 'E' = 0xc388 @@ -214,7 +215,12 @@ Grave 'e' = 0xc3a8 Grave 'i' = 0xc3ac Grave 'o' = 0xc3b2 Grave 'u' = 0xc3b9 -GraveTab = Option CapsLock-Option +Grave '' = '' +Grave '' = '' +Grave '' = '' +Grave '' = '' +Grave '' = '' +GraveTab = Option CapsLock-Option Circumflex ' ' = '^' Circumflex 'A' = 0xc382 Circumflex 'E' = 0xc38a @@ -226,8 +232,13 @@ Circumflex 'e' = 0xc3aa Circumflex 'i' = 0xc3ae Circumflex 'o' = 0xc3b4 Circumflex 'u' = 0xc3bb -CircumflexTab = Normal Shift CapsLock CapsLock-Shift -Diaeresis ' ' = 0xc2a8 +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +Circumflex '' = '' +CircumflexTab = Option-Shift CapsLock-Shift-Option +Diaeresis ' ' = 0xc2a8 Diaeresis 'A' = 0xc384 Diaeresis 'E' = 0xc38b Diaeresis 'I' = 0xc38f @@ -240,7 +251,10 @@ Diaeresis 'i' = 0xc3af Diaeresis 'o' = 0xc3b6 Diaeresis 'u' = 0xc3bc Diaeresis 'y' = 0xc3bf -DiaeresisTab = Option-Shift CapsLock-Option-Shift +Diaeresis '' = '' +Diaeresis '' = '' +Diaeresis '' = '' +DiaeresisTab = Option-Shift CapsLock-Shift-Option Tilde ' ' = '~' Tilde 'A' = 0xc383 Tilde 'O' = 0xc395 @@ -248,4 +262,13 @@ Tilde 'N' = 0xc391 Tilde 'a' = 0xc3a3 Tilde 'o' = 0xc3b5 Tilde 'n' = 0xc3b1 -TildeTab = Normal Shift CapsLock CapsLock-Shift +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +Tilde '' = '' +TildeTab = Option-Shift CapsLock-Shift-Option diff --git a/src/data/keymaps/American.keymap b/src/data/keymaps/US.keymap similarity index 73% rename from src/data/keymaps/American.keymap rename to src/data/keymaps/US.keymap index 72f9f4d0d4..ca4cbc4172 100644 --- a/src/data/keymaps/American.keymap +++ b/src/data/keymaps/US.keymap @@ -58,7 +58,7 @@ LockSettings = # c = Control # C = CapsLock # o = Option -# Key n s c o os C Cs Co Cos +# Key n s c o os C Cs Co Cos Key 0x00 = '' '' '' '' '' '' '' '' '' Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 @@ -76,19 +76,19 @@ Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x11 = '`' '~' '' ' ' '' '`' '~' ' ' '' -Key 0x12 = '1' '!' '' ' ' '' '1' '!' ' ' '' -Key 0x13 = '2' '@' 0x00 ' ' '' '2' '@' ' ' '' -Key 0x14 = '3' '#' '' ' ' '' '3' '#' ' ' '' -Key 0x15 = '4' '$' '' ' ' '' '4' '$' ' ' '' -Key 0x16 = '5' '%' '' ' ' '' '5' '%' ' ' '' -Key 0x17 = '6' '^' 0x1e ' ' '' '6' '^' ' ' '' -Key 0x18 = '7' '&' '' ' ' '' '7' '&' ' ' '' -Key 0x19 = '8' '*' '' ' ' '' '8' '*' ' ' '' -Key 0x1a = '9' '(' '' ' ' '' '9' '(' ' ' '' -Key 0x1b = '0' ')' '' ' ' '' '0' ')' ' ' '' -Key 0x1c = '-' '_' 0x1f ' ' '' '-' '_' ' ' '' -Key 0x1d = '=' '+' '' ' ' '' '=' '+' ' ' '' +Key 0x11 = '`' '~' '' '' '' '`' '~' '' '' +Key 0x12 = '1' '!' '' '' '' '1' '!' '' '' +Key 0x13 = '2' '@' 0x00 '' '' '2' '@' '' '' +Key 0x14 = '3' '#' '' '' '' '3' '#' '' '' +Key 0x15 = '4' '$' '' '' '' '4' '$' '' '' +Key 0x16 = '5' '%' '' '' '' '5' '%' '' '' +Key 0x17 = '6' '^' 0x1e '' '' '6' '^' '' '' +Key 0x18 = '7' '&' '' '' '' '7' '&' '' '' +Key 0x19 = '8' '*' '' '' '' '8' '*' '' '' +Key 0x1a = '9' '(' '' '' '' '9' '(' '' '' +Key 0x1b = '0' ')' '' '' '' '0' ')' '' '' +Key 0x1c = '-' '_' 0x1f '' '' '-' '_' '' '' +Key 0x1d = '=' '+' '' '' '' '=' '+' '' '' Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 @@ -98,19 +98,19 @@ Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 -Key 0x27 = 'q' 'Q' 0x11 ' ' '' 'Q' 'q' ' ' '' -Key 0x28 = 'w' 'W' 0x17 ' ' '' 'W' 'w' ' ' '' -Key 0x29 = 'e' 'E' 0x05 ' ' '' 'E' 'e' ' ' '' -Key 0x2a = 'r' 'R' 0x12 ' ' '' 'R' 'r' ' ' '' -Key 0x2b = 't' 'T' 0x14 ' ' '' 'T' 't' ' ' '' -Key 0x2c = 'y' 'Y' 0x19 ' ' '' 'Y' 'y' ' ' '' -Key 0x2d = 'u' 'U' 0x15 ' ' '' 'U' 'u' ' ' '' -Key 0x2e = 'i' 'I' 0x09 ' ' '' 'I' 'i' ' ' '' -Key 0x2f = 'o' 'O' 0x0f ' ' '' 'O' 'o' ' ' '' -Key 0x30 = 'p' 'P' 0x10 ' ' '' 'P' 'p' ' ' '' -Key 0x31 = '[' '{' 0x1b ' ' '' '[' '{' ' ' '' -Key 0x32 = ']' '}' 0x1d ' ' '' ']' '}' ' ' '' -Key 0x33 = '\\' '|' 0x1c ' ' '' '\\' '|' ' ' '' +Key 0x27 = 'q' 'Q' 0x11 '' '' 'Q' 'q' '' '' +Key 0x28 = 'w' 'W' 0x17 '' '' 'W' 'w' '' '' +Key 0x29 = 'e' 'E' 0x05 '' '' 'E' 'e' '' '' +Key 0x2a = 'r' 'R' 0x12 '' '' 'R' 'r' '' '' +Key 0x2b = 't' 'T' 0x14 '' '' 'T' 't' '' '' +Key 0x2c = 'y' 'Y' 0x19 '' '' 'Y' 'y' '' '' +Key 0x2d = 'u' 'U' 0x15 '' '' 'U' 'u' '' '' +Key 0x2e = 'i' 'I' 0x09 '' '' 'I' 'i' '' '' +Key 0x2f = 'o' 'O' 0x0f '' '' 'O' 'o' '' '' +Key 0x30 = 'p' 'P' 0x10 '' '' 'P' 'p' '' '' +Key 0x31 = '[' '{' 0x1b '' '' '[' '{' '' '' +Key 0x32 = ']' '}' 0x1d '' '' ']' '}' '' '' +Key 0x33 = '\\' '|' 0x1c '' '' '\\' '|' '' '' Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c @@ -119,32 +119,32 @@ Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' 0x1e Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' 0x0b '9' Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' Key 0x3b = '' '' '' '' '' '' '' '' '' -Key 0x3c = 'a' 'A' 0x01 ' ' '' 'A' 'a' ' ' '' -Key 0x3d = 's' 'S' 0x13 ' ' '' 'S' 's' ' ' '' -Key 0x3e = 'd' 'D' 0x04 ' ' '' 'D' 'd' ' ' '' -Key 0x3f = 'f' 'F' 0x06 ' ' '' 'F' 'f' ' ' '' -Key 0x40 = 'g' 'G' 0x07 ' ' '' 'G' 'g' ' ' '' -Key 0x41 = 'h' 'H' 0x08 ' ' '' 'H' 'h' ' ' '' -Key 0x42 = 'j' 'J' 0x0a ' ' '' 'J' 'j' ' ' '' -Key 0x43 = 'k' 'K' 0x0b ' ' '' 'K' 'k' ' ' '' -Key 0x44 = 'l' 'L' 0x0c ' ' '' 'L' 'l' ' ' '' -Key 0x45 = ';' ':' '' ' ' '' ';' ':' ' ' '' -Key 0x46 = '\'' '"' '' ' ' '' '\'' '"' ' ' '' +Key 0x3c = 'a' 'A' 0x01 '' '' 'A' 'a' '' '' +Key 0x3d = 's' 'S' 0x13 '' '' 'S' 's' '' '' +Key 0x3e = 'd' 'D' 0x04 '' '' 'D' 'd' '' '' +Key 0x3f = 'f' 'F' 0x06 '' '' 'F' 'f' '' '' +Key 0x40 = 'g' 'G' 0x07 '' '' 'G' 'g' '' '' +Key 0x41 = 'h' 'H' 0x08 '' '' 'H' 'h' '' '' +Key 0x42 = 'j' 'J' 0x0a '' '' 'J' 'j' '' '' +Key 0x43 = 'k' 'K' 0x0b '' '' 'K' 'k' '' '' +Key 0x44 = 'l' 'L' 0x0c '' '' 'L' 'l' '' '' +Key 0x45 = ';' ':' '' '' '' ';' ':' '' '' +Key 0x46 = '\'' '"' '' '' '' '\'' '"' '' '' Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' 0x1c '4' Key 0x49 = '' '5' '' '' '5' '' '5' '' '5' Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' 0x1d '6' Key 0x4b = '' '' '' '' '' '' '' '' '' -Key 0x4c = 'z' 'Z' 0x1a ' ' '' 'Z' 'z' ' ' '' -Key 0x4d = 'x' 'X' 0x18 ' ' '' 'X' 'x' ' ' '' -Key 0x4e = 'c' 'C' 0x03 ' ' '' 'C' 'c' ' ' '' -Key 0x4f = 'v' 'V' 0x16 ' ' '' 'V' 'v' ' ' '' -Key 0x50 = 'b' 'B' 0x02 ' ' '' 'B' 'b' ' ' '' -Key 0x51 = 'n' 'N' 0x0e ' ' '' 'N' 'n' ' ' '' -Key 0x52 = 'm' 'M' 0x0d ' ' '' 'M' 'm' ' ' '' -Key 0x53 = ',' '<' '' ' ' '' ',' '<' ' ' '' -Key 0x54 = '.' '>' '' ' ' '' '.' '>' ' ' '' -Key 0x55 = '/' '?' '' ' ' '' '/' '?' ' ' '' +Key 0x4c = 'z' 'Z' 0x1a '' '' 'Z' 'z' '' '' +Key 0x4d = 'x' 'X' 0x18 '' '' 'X' 'x' '' '' +Key 0x4e = 'c' 'C' 0x03 '' '' 'C' 'c' '' '' +Key 0x4f = 'v' 'V' 0x16 '' '' 'V' 'v' '' '' +Key 0x50 = 'b' 'B' 0x02 '' '' 'B' 'b' '' '' +Key 0x51 = 'n' 'N' 0x0e '' '' 'N' 'n' '' '' +Key 0x52 = 'm' 'M' 0x0d '' '' 'M' 'm' '' '' +Key 0x53 = ',' '<' '' '' '' ',' '<' '' '' +Key 0x54 = '.' '>' '' '' '' '.' '>' '' '' +Key 0x55 = '/' '?' '' '' '' '/' '?' '' '' Key 0x56 = '' '' '' '' '' '' '' '' '' Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' 0x04 '1' @@ -164,7 +164,7 @@ Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' 0x7f Key 0x66 = '' '' '' '' '' '' '' '' '' Key 0x67 = '' '' '' '' '' '' '' '' '' Key 0x68 = '' '' '' '' '' '' '' '' '' -Key 0x69 = '\\' '|' 0x1c ' ' '' '\\' '|' ' ' '' +Key 0x69 = '\\' '|' 0x1c '' '' '\\' '|' '' '' Key 0x6a = '' '' '' '' '' '' '' '' '' Key 0x6b = '' '' '' '' '' '' '' '' '' Key 0x6c = '' '' '' '' '' '' '' '' '' diff --git a/src/data/keymaps/United-Kingdom.keymap b/src/data/keymaps/United-Kingdom.keymap index 8d338334c5..0e0eb4cb47 100644 --- a/src/data/keymaps/United-Kingdom.keymap +++ b/src/data/keymaps/United-Kingdom.keymap @@ -37,11 +37,11 @@ NumLock = 0x22 LShift = 0x4b RShift = 0x56 LCommand = 0x5d -RCommand = 0x00 +RCommand = 0x5f LControl = 0x5c RControl = 0x60 LOption = 0x66 -ROption = 0x5f +ROption = 0x67 Menu = 0x68 # # Lock settings @@ -58,7 +58,7 @@ LockSettings = # c = Control # C = CapsLock # o = Option -# Key n s c o os C Cs Co Cos +# Key n s c o os C Cs Co Cos Key 0x00 = '' '' '' '' '' '' '' '' '' Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 @@ -76,19 +76,19 @@ Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 -Key 0x11 = '`' 0xc2ac '' 0xc2a6 '' '`' 0xc2ac 0xc2a6 '' -Key 0x12 = '1' '!' '' ' ' '' '1' '!' ' ' '' -Key 0x13 = '2' '"' '' ' ' '' '2' '"' ' ' '' -Key 0x14 = '3' 0xc2a3 '' ' ' '' '3' 0xc2a3 ' ' '' -Key 0x15 = '4' '$' '' 0xe282ac '' '4' '$' 0xe282ac '' -Key 0x16 = '5' '%' '' ' ' '' '5' '%' ' ' '' -Key 0x17 = '6' '^' 0x1e ' ' '' '6' '^' ' ' '' -Key 0x18 = '7' '&' '' ' ' '' '7' '&' ' ' '' -Key 0x19 = '8' '*' '' ' ' '' '8' '*' ' ' '' -Key 0x1a = '9' '(' '' ' ' '' '9' '(' ' ' '' -Key 0x1b = '0' ')' '' ' ' '' '0' ')' ' ' '' -Key 0x1c = '-' '_' 0x1f ' ' '' '-' '_' ' ' '' -Key 0x1d = '=' '+' '' ' ' '' '=' '+' ' ' '' +Key 0x11 = '`' 0xc2ac '' 0xc2a6 '' '`' 0xc2ac '' 0xc2a6 +Key 0x12 = '1' '!' '' '' '' '1' '!' '' '' +Key 0x13 = '2' '"' '' '' '' '2' '"' '' '' +Key 0x14 = '3' 0xc2a3 '' '' '' '3' 0xc2a3 '' '' +Key 0x15 = '4' '$' '' 0xe282ac '' '4' '$' '' 0xe282ac +Key 0x16 = '5' '%' '' '' '' '5' '%' '' '' +Key 0x17 = '6' '^' 0x1e '' '' '6' '^' '' '' +Key 0x18 = '7' '&' '' '' '' '7' '&' '' '' +Key 0x19 = '8' '*' '' '' '' '8' '*' '' '' +Key 0x1a = '9' '(' '' '' '' '9' '(' '' '' +Key 0x1b = '0' ')' '' '' '' '0' ')' '' '' +Key 0x1c = '-' '_' 0x1f '' '' '-' '_' '' '' +Key 0x1d = '=' '+' '' '' '' '=' '+' '' '' Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 @@ -98,58 +98,58 @@ Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 -Key 0x27 = 'q' 'Q' 0x11 ' ' '' 'Q' 'q' ' ' '' -Key 0x28 = 'w' 'W' 0x17 ' ' '' 'W' 'w' ' ' '' +Key 0x27 = 'q' 'Q' 0x11 '' '' 'Q' 'q' '' '' +Key 0x28 = 'w' 'W' 0x17 '' '' 'W' 'w' '' '' Key 0x29 = 'e' 'E' 0x05 0xc3a9 0xc389 'E' 'e' 0xc389 0xc3a9 -Key 0x2a = 'r' 'R' 0x12 ' ' '' 'R' 'r' ' ' '' -Key 0x2b = 't' 'T' 0x14 ' ' '' 'T' 't' ' ' '' -Key 0x2c = 'y' 'Y' 0x19 ' ' '' 'Y' 'y' ' ' '' +Key 0x2a = 'r' 'R' 0x12 '' '' 'R' 'r' '' '' +Key 0x2b = 't' 'T' 0x14 '' '' 'T' 't' '' '' +Key 0x2c = 'y' 'Y' 0x19 '' '' 'Y' 'y' '' '' Key 0x2d = 'u' 'U' 0x15 0xc3ba 0xc39a 'U' 'u' 0xc39a 0xc3ba Key 0x2e = 'i' 'I' 0x09 0xc3ad 0xc38d 'I' 'i' 0xc38d 0xc3ad Key 0x2f = 'o' 'O' 0x0f 0xc3b3 0xc393 'O' 'o' 0xc393 0xc3b3 -Key 0x30 = 'p' 'P' 0x10 ' ' '' 'P' 'p' ' ' '' -Key 0x31 = '[' '{' 0x1b ' ' '' '[' '{' ' ' '' -Key 0x32 = ']' '}' 0x1d ' ' '' ']' '}' ' ' '' -Key 0x33 = '#' '~' 0x1c ' ' '' '#' '~' ' ' '' +Key 0x30 = 'p' 'P' 0x10 '' '' 'P' 'p' '' '' +Key 0x31 = '[' '{' 0x1b '' '' '[' '{' '' '' +Key 0x32 = ']' '}' 0x1d '' '' ']' '}' '' '' +Key 0x33 = '#' '~' 0x1c '' '' '#' '~' '' '' Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c -Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' 0x01 '7' -Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' 0x1e '8' -Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' 0x0b '9' +Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' '7' 0x01 +Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' '8' 0x1e +Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' '9' 0x0b Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' Key 0x3b = '' '' '' '' '' '' '' '' '' Key 0x3c = 'a' 'A' 0x01 0xc3a1 0xc381 'A' 'a' 0xc381 0xc3a1 -Key 0x3d = 's' 'S' 0x13 ' ' '' 'S' 's' ' ' '' -Key 0x3e = 'd' 'D' 0x04 ' ' '' 'D' 'd' ' ' '' -Key 0x3f = 'f' 'F' 0x06 ' ' '' 'F' 'f' ' ' '' -Key 0x40 = 'g' 'G' 0x07 ' ' '' 'G' 'g' ' ' '' -Key 0x41 = 'h' 'H' 0x08 ' ' '' 'H' 'h' ' ' '' -Key 0x42 = 'j' 'J' 0x0a ' ' '' 'J' 'j' ' ' '' -Key 0x43 = 'k' 'K' 0x0b ' ' '' 'K' 'k' ' ' '' -Key 0x44 = 'l' 'L' 0x0c ' ' '' 'L' 'l' ' ' '' -Key 0x45 = ';' ':' '' ' ' '' ';' ':' ' ' '' -Key 0x46 = '\'' '@' 0x00 ' ' '' '\'' '@' ' ' '' +Key 0x3d = 's' 'S' 0x13 '' '' 'S' 's' '' '' +Key 0x3e = 'd' 'D' 0x04 '' '' 'D' 'd' '' '' +Key 0x3f = 'f' 'F' 0x06 '' '' 'F' 'f' '' '' +Key 0x40 = 'g' 'G' 0x07 '' '' 'G' 'g' '' '' +Key 0x41 = 'h' 'H' 0x08 '' '' 'H' 'h' '' '' +Key 0x42 = 'j' 'J' 0x0a '' '' 'J' 'j' '' '' +Key 0x43 = 'k' 'K' 0x0b '' '' 'K' 'k' '' '' +Key 0x44 = 'l' 'L' 0x0c '' '' 'L' 'l' '' '' +Key 0x45 = ';' ':' '' '' '' ';' ':' '' '' +Key 0x46 = '\'' '@' 0x00 '' '' '\'' '@' '' '' Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a -Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' 0x1c '4' -Key 0x49 = '' '5' '' '' '5' '' '5' '' '5' -Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' 0x1d '6' +Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' '4' 0x1c +Key 0x49 = '' '5' '' '' '5' '' '5' '5' '' +Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' '6' 0x1d Key 0x4b = '' '' '' '' '' '' '' '' '' -Key 0x4c = 'z' 'Z' 0x1a ' ' '' 'Z' 'z' ' ' '' -Key 0x4d = 'x' 'X' 0x18 ' ' '' 'X' 'x' ' ' '' -Key 0x4e = 'c' 'C' 0x03 ' ' '' 'C' 'c' ' ' '' -Key 0x4f = 'v' 'V' 0x16 ' ' '' 'V' 'v' ' ' '' -Key 0x50 = 'b' 'B' 0x02 ' ' '' 'B' 'b' ' ' '' -Key 0x51 = 'n' 'N' 0x0e ' ' '' 'N' 'n' ' ' '' -Key 0x52 = 'm' 'M' 0x0d ' ' '' 'M' 'm' ' ' '' -Key 0x53 = ',' '<' '' ' ' '' ',' '<' ' ' '' -Key 0x54 = '.' '>' '' ' ' '' '.' '>' ' ' '' -Key 0x55 = '/' '?' '' ' ' '' '/' '?' ' ' '' +Key 0x4c = 'z' 'Z' 0x1a '' '' 'Z' 'z' '' '' +Key 0x4d = 'x' 'X' 0x18 '' '' 'X' 'x' '' '' +Key 0x4e = 'c' 'C' 0x03 '' '' 'C' 'c' '' '' +Key 0x4f = 'v' 'V' 0x16 '' '' 'V' 'v' '' '' +Key 0x50 = 'b' 'B' 0x02 '' '' 'B' 'b' '' '' +Key 0x51 = 'n' 'N' 0x0e '' '' 'N' 'n' '' '' +Key 0x52 = 'm' 'M' 0x0d '' '' 'M' 'm' '' '' +Key 0x53 = ',' '<' '' '' '' ',' '<' '' '' +Key 0x54 = '.' '>' '' '' '' '.' '>' '' '' +Key 0x55 = '/' '?' '' '' '' '/' '?' '' '' Key 0x56 = '' '' '' '' '' '' '' '' '' Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e -Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' 0x04 '1' -Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' 0x1f '2' -Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' 0x0c '3' +Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' '1' 0x04 +Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' '2' 0x1f +Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' '3' 0x0c Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a Key 0x5c = '' '' '' '' '' '' '' '' '' Key 0x5d = '' '' '' '' '' '' '' '' '' @@ -159,12 +159,12 @@ Key 0x60 = '' '' '' '' '' '' '' '' Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d -Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' 0x05 '0' -Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' 0x7f '.' +Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' '0' 0x05 +Key 0x65 = 0x7f '.' 0x7f 0x7f '.' 0x7f '.' '.' 0x7f Key 0x66 = '' '' '' '' '' '' '' '' '' Key 0x67 = '' '' '' '' '' '' '' '' '' Key 0x68 = '' '' '' '' '' '' '' '' '' -Key 0x69 = '\\' '|' 0x1c ' ' '' '\\' '|' ' ' '' +Key 0x69 = '\\' '|' 0x1c '' '' '\\' '|' '' '' Key 0x6a = '' '' '' '' '' '' '' '' '' Key 0x6b = '' '' '' '' '' '' '' '' '' Key 0x6c = '' '' '' '' '' '' '' '' '' diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 80729cdad4..8292e52158 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -276,8 +276,8 @@ BWindow::Shortcut::Matches(uint32 key, uint32 modifiers) const uint32 BWindow::Shortcut::AllowedModifiers() { - return B_COMMAND_KEY | B_OPTION_KEY | B_SHIFT_KEY - | B_CONTROL_KEY | B_MENU_KEY; + return B_COMMAND_KEY | B_OPTION_KEY | B_SHIFT_KEY | B_CONTROL_KEY + | B_MENU_KEY; } @@ -3749,6 +3749,7 @@ BWindow::_HandleKeyDown(BMessage* event) message.AddBool("shortcut", true); be_app->PostMessage(&message); + // eat the event return true; } diff --git a/src/kits/shared/Keymap.cpp b/src/kits/shared/Keymap.cpp index fe6fe970ae..9ffe977b00 100644 --- a/src/kits/shared/Keymap.cpp +++ b/src/kits/shared/Keymap.cpp @@ -1,10 +1,11 @@ /* - * Copyright 2004-2010, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Jérôme Duval * Axel Dörfler, axeld@pinc-software.de. + * John Scipione, jscipione@gmail.com. */ @@ -36,8 +37,8 @@ enum dead_key_index { }; -static const uint32 kModifierKeys = B_SHIFT_KEY | B_COMMAND_KEY | B_CONTROL_KEY - | B_CAPS_LOCK | B_OPTION_KEY | B_MENU_KEY; +static const uint32 kModifierKeys = B_SHIFT_KEY | B_CAPS_LOCK | B_CONTROL_KEY + | B_OPTION_KEY | B_COMMAND_KEY | B_MENU_KEY; BKeymap::BKeymap() @@ -365,8 +366,19 @@ BKeymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, // here we get the char size *numBytes = fChars[offset]; - if (!*numBytes) - return; + if (*numBytes <= 0) { + // if key is not mapped in the option table, fall-through. + if ((modifiers & B_OPTION_KEY) != 0) { + offset = Offset(keyCode, modifiers & ~B_OPTION_KEY); + if (offset < 0) + return; + // get the char size again + *numBytes = fChars[offset]; + if (*numBytes <= 0) + return; + } else + return; + } // here we take an potential active dead key const int32* deadKey; @@ -481,6 +493,10 @@ BKeymap::Offset(uint32 keyCode, uint32 modifiers, uint32* _table) const offset = fKeys.caps_shift_map[keyCode]; table = B_CAPS_SHIFT_TABLE; break; + case B_CONTROL_KEY: + offset = fKeys.control_map[keyCode]; + table = B_CONTROL_TABLE; + break; case B_OPTION_KEY: offset = fKeys.option_map[keyCode]; table = B_OPTION_TABLE; @@ -497,10 +513,6 @@ BKeymap::Offset(uint32 keyCode, uint32 modifiers, uint32* _table) const offset = fKeys.option_caps_shift_map[keyCode]; table = B_OPTION_CAPS_SHIFT_TABLE; break; - case B_CONTROL_KEY: - offset = fKeys.control_map[keyCode]; - table = B_CONTROL_TABLE; - break; default: offset = fKeys.normal_map[keyCode]; table = B_NORMAL_TABLE; diff --git a/src/preferences/keymap/KeyboardLayout.cpp b/src/preferences/keymap/KeyboardLayout.cpp index f25530e0e1..caabcbac3c 100644 --- a/src/preferences/keymap/KeyboardLayout.cpp +++ b/src/preferences/keymap/KeyboardLayout.cpp @@ -99,6 +99,33 @@ KeyboardLayout::DefaultKeySize() int32 KeyboardLayout::IndexForModifier(int32 modifier) { + switch(modifier) { + case B_CAPS_LOCK: + return 58; + case B_NUM_LOCK: + return 33; + case B_SCROLL_LOCK: + return 14; + case B_LEFT_SHIFT_KEY: + return 74; + case B_RIGHT_SHIFT_KEY: + return 85; + case B_LEFT_CONTROL_KEY: + return 91; + case B_RIGHT_CONTROL_KEY: + return 98; + case B_LEFT_OPTION_KEY: + return 92; + case B_RIGHT_OPTION_KEY: + return 96; + case B_LEFT_COMMAND_KEY: + return 93; + case B_RIGHT_COMMAND_KEY: + return 95; + case B_MENU_KEY: + return 97; + } + return 0; } diff --git a/src/preferences/keymap/Keymap.cpp b/src/preferences/keymap/Keymap.cpp index 283aa67a8c..6001ae72f5 100644 --- a/src/preferences/keymap/Keymap.cpp +++ b/src/preferences/keymap/Keymap.cpp @@ -21,8 +21,8 @@ #include -static const uint32 kModifierKeys = B_SHIFT_KEY | B_COMMAND_KEY | B_CONTROL_KEY - | B_CAPS_LOCK | B_OPTION_KEY | B_MENU_KEY; +static const uint32 kModifierKeys = B_SHIFT_KEY | B_CAPS_LOCK | B_CONTROL_KEY + | B_OPTION_KEY | B_COMMAND_KEY | B_MENU_KEY; static void @@ -33,12 +33,12 @@ print_key(char *chars, int32 offset) switch (size) { case 0: // Not mapped - printf("N/A"); + fputs("N/A", stdout); break; case 1: - // 1-byte UTF-8/ASCII character - printf("%c", chars[offset]); + // single-byte UTF-8/ASCII character + fputc(chars[offset], stdout); break; default: @@ -47,13 +47,13 @@ print_key(char *chars, int32 offset) char *str = new char[size + 1]; strncpy(str, &chars[offset], size); str[size] = 0; - printf("%s", str); + fputs(str, stdout); delete[] str; break; } } - printf("\t"); + fputs("\t", stdout); } @@ -93,22 +93,25 @@ Keymap::SetName(const char* name) void Keymap::DumpKeymap() { - // Print a chart of the normal, shift, option, and option+shift - // keys. - printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\t" - "Control\n"); - for (int i = 0; i < 128; i++) { - printf(" 0x%x\t", i); + if (fKeys.version != 3) + return; + + // Print a chart of the normal, shift, control, option, option+shift, + // Caps, Caps+shift, Caps+option, and Caps+option+shift keys. + puts("Key #\tn\ts\tc\to\tos\tC\tCs\tCo\tCos\n"); + + for (uint8 i = 0; i < 128; i++) { + printf(" 0x%02x\t", i); print_key(fChars, fKeys.normal_map[i]); print_key(fChars, fKeys.shift_map[i]); - print_key(fChars, fKeys.caps_map[i]); - print_key(fChars, fKeys.caps_shift_map[i]); + print_key(fChars, fKeys.control_map[i]); print_key(fChars, fKeys.option_map[i]); print_key(fChars, fKeys.option_shift_map[i]); + print_key(fChars, fKeys.caps_map[i]); + print_key(fChars, fKeys.caps_shift_map[i]); print_key(fChars, fKeys.option_caps_map[i]); print_key(fChars, fKeys.option_caps_shift_map[i]); - print_key(fChars, fKeys.control_map[i]); - printf("\n"); + fputs("\n", stdout); } } @@ -190,12 +193,12 @@ Keymap::Save(const entry_ref& ref) status_t Keymap::SetModifier(uint32 keyCode, uint32 modifier) { - const uint32 kSingleKeys = B_LEFT_SHIFT_KEY | B_RIGHT_SHIFT_KEY + const uint32 kSingleModifierKeys = B_LEFT_SHIFT_KEY | B_RIGHT_SHIFT_KEY | B_LEFT_COMMAND_KEY | B_RIGHT_COMMAND_KEY | B_LEFT_CONTROL_KEY | B_RIGHT_CONTROL_KEY | B_LEFT_OPTION_KEY | B_RIGHT_OPTION_KEY; - if ((modifier & kSingleKeys) != 0) - modifier &= kSingleKeys; + if ((modifier & kSingleModifierKeys) != 0) + modifier &= kSingleModifierKeys; else if ((modifier & kModifierKeys) != 0) modifier &= kModifierKeys; @@ -322,9 +325,9 @@ Keymap::SetDeadKeyTrigger(dead_key_index deadKeyIndex, const BString& trigger) &fKeys.tilde_tables }; *deadTables[deadKeyIndex - 1] - = B_CONTROL_TABLE | B_OPTION_CAPS_SHIFT_TABLE | B_OPTION_CAPS_TABLE - | B_OPTION_SHIFT_TABLE | B_OPTION_TABLE | B_CAPS_SHIFT_TABLE - | B_CAPS_TABLE | B_SHIFT_TABLE | B_NORMAL_TABLE; + = B_NORMAL_TABLE | B_SHIFT_TABLE | B_CONTROL_TABLE | B_OPTION_TABLE + | B_OPTION_SHIFT_TABLE | B_CAPS_TABLE | B_CAPS_SHIFT_TABLE + | B_OPTION_CAPS_TABLE | B_OPTION_CAPS_SHIFT_TABLE; if (fModificationMessage != NULL) fTarget.SendMessage(fModificationMessage); diff --git a/src/preferences/keymap/KeymapApplication.cpp b/src/preferences/keymap/KeymapApplication.cpp index 497fbb09c6..f7bf5f615a 100644 --- a/src/preferences/keymap/KeymapApplication.cpp +++ b/src/preferences/keymap/KeymapApplication.cpp @@ -32,7 +32,7 @@ KeymapApplication::MessageReceived(BMessage* message) case kMsgCloseModifierKeysWindow: fModifierKeysWindow = NULL; break; - case kMsgUpdateModifiers: + case kMsgUpdateModifierKeys: fWindow->PostMessage(message); break; } diff --git a/src/preferences/keymap/KeymapApplication.h b/src/preferences/keymap/KeymapApplication.h index 217fefa82c..df4a8b8ae4 100644 --- a/src/preferences/keymap/KeymapApplication.h +++ b/src/preferences/keymap/KeymapApplication.h @@ -23,7 +23,7 @@ static const uint32 kMsgShowModifierKeysWindow = 'smkw'; static const uint32 kMsgCloseModifierKeysWindow = 'hmkw'; -static const uint32 kMsgUpdateModifiers = 'upmd'; +static const uint32 kMsgUpdateModifierKeys = 'umks'; class KeymapApplication : public BApplication { diff --git a/src/preferences/keymap/KeymapWindow.cpp b/src/preferences/keymap/KeymapWindow.cpp index 11c253b145..0d8b0ef7d3 100644 --- a/src/preferences/keymap/KeymapWindow.cpp +++ b/src/preferences/keymap/KeymapWindow.cpp @@ -297,30 +297,33 @@ KeymapWindow::MessageReceived(BMessage* message) _UpdateButtons(); break; - case kMsgUpdateModifiers: + case kMsgUpdateModifierKeys: { uint32 keycode; - if (message->FindUInt32("caps_key", &keycode) == B_OK) - fCurrentMap.Map().caps_key = keycode; + if (message->FindUInt32("left_shift_key", &keycode) == B_OK) + fCurrentMap.SetModifier(keycode, B_LEFT_SHIFT_KEY); + + if (message->FindUInt32("right_shift_key", &keycode) == B_OK) + fCurrentMap.SetModifier(keycode, B_RIGHT_SHIFT_KEY); if (message->FindUInt32("left_control_key", &keycode) == B_OK) - fCurrentMap.Map().left_control_key = keycode; + fCurrentMap.SetModifier(keycode, B_LEFT_CONTROL_KEY); if (message->FindUInt32("right_control_key", &keycode) == B_OK) - fCurrentMap.Map().right_control_key = keycode; + fCurrentMap.SetModifier(keycode, B_RIGHT_CONTROL_KEY); if (message->FindUInt32("left_option_key", &keycode) == B_OK) - fCurrentMap.Map().left_option_key = keycode; + fCurrentMap.SetModifier(keycode, B_LEFT_OPTION_KEY); if (message->FindUInt32("right_option_key", &keycode) == B_OK) - fCurrentMap.Map().right_option_key = keycode; + fCurrentMap.SetModifier(keycode, B_RIGHT_OPTION_KEY); if (message->FindUInt32("left_command_key", &keycode) == B_OK) - fCurrentMap.Map().left_command_key = keycode; + fCurrentMap.SetModifier(keycode, B_LEFT_COMMAND_KEY); if (message->FindUInt32("right_command_key", &keycode) == B_OK) - fCurrentMap.Map().right_command_key = keycode; + fCurrentMap.SetModifier(keycode, B_RIGHT_COMMAND_KEY); _UpdateButtons(); fKeyboardLayoutView->SetKeymap(&fCurrentMap); diff --git a/src/preferences/keymap/ModifierKeysWindow.cpp b/src/preferences/keymap/ModifierKeysWindow.cpp index f41aa4a9f4..4943465b82 100644 --- a/src/preferences/keymap/ModifierKeysWindow.cpp +++ b/src/preferences/keymap/ModifierKeysWindow.cpp @@ -14,21 +14,41 @@ #include #include +#include #include #include #include +#include #include #include #include #include +#include +#include #include -#include #include "KeymapApplication.h" +#ifdef DEBUG_ALERT +# define FTRACE(x) fprintf(x) +#else +# define FTRACE(x) /* nothing */ +#endif + + +const rgb_color disabledColor = (rgb_color){128, 128, 128, 255}; +const rgb_color normalColor = (rgb_color){0, 0, 0, 255}; + enum { - MENU_ITEM_CAPS_LOCK = 0, + SHIFT_KEY = 0x00000001, + CONTROL_KEY = 0x00000002, + OPTION_KEY = 0x00000004, + COMMAND_KEY = 0x00000008 +}; + +enum { + MENU_ITEM_SHIFT = 0, MENU_ITEM_CONTROL, MENU_ITEM_OPTION, MENU_ITEM_COMMAND, @@ -40,8 +60,6 @@ static const uint32 kMsgUpdateModifier = 'upmd'; static const uint32 kMsgApplyModifiers = 'apmd'; static const uint32 kMsgRevertModifiers = 'rvmd'; -static int32 kInitialSwitchRight; - #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "Modifier keys window" @@ -49,36 +67,72 @@ static int32 kInitialSwitchRight; ModifierKeysWindow::ModifierKeysWindow() : - BWindow(BRect(80, 50, 400, 260), B_TRANSLATE("Modifier keys"), + BWindow(BRect(0, 0, 360, 220), B_TRANSLATE("Modifier keys"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { get_key_map(&fCurrentMap, &fCurrentBuffer); get_key_map(&fSavedMap, &fSavedBuffer); - BStringView* capsLockStringView - = new BStringView("caps", B_TRANSLATE("Caps Lock:")); - capsLockStringView->SetExplicitMaxSize( - BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + BStringView* keyRole = new BStringView("key role", + B_TRANSLATE_COMMENT("Key role", + "key roles, e.g. Control, Option, Command")); + keyRole->SetAlignment(B_ALIGN_RIGHT); + keyRole->SetFont(be_bold_font); - BStringView* controlStringView - = new BStringView("control", B_TRANSLATE("Control:")); - controlStringView->SetExplicitMaxSize( - BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + BStringView* keyLabel = new BStringView("key label", + B_TRANSLATE_COMMENT("Key", "A computer keyboard key")); + keyLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + keyLabel->SetFont(be_bold_font); - BStringView* optionStringView - = new BStringView("option", B_TRANSLATE("Win/Option:")); - optionStringView->SetExplicitMaxSize( - BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + float width = 0.0; + float widest = 0.0; - BStringView* commandStringView - = new BStringView("command", B_TRANSLATE("Alt/Command:")); - commandStringView->SetExplicitMaxSize( - BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + fShiftStringView = new BStringView("shift", + B_TRANSLATE_COMMENT("Shift:", "Shift key role name")); + fShiftStringView->SetAlignment(B_ALIGN_RIGHT); + width = fShiftStringView->StringWidth(fShiftStringView->Text()); + if (width > widest) + widest = width; - fSwitchRight = new BCheckBox("switchRight", - B_TRANSLATE("Switch right Alt/Command and Win/Option keys"), - new BMessage(kMsgUpdateModifier)); + fControlStringView = new BStringView("control", + B_TRANSLATE_COMMENT("Control:", "Control key role name")); + fControlStringView->SetAlignment(B_ALIGN_RIGHT); + width = fControlStringView->StringWidth(fControlStringView->Text()); + if (width > widest) + widest = width; + + fOptionStringView = new BStringView("option", + B_TRANSLATE_COMMENT("Option:", "Option key role name")); + fOptionStringView->SetAlignment(B_ALIGN_RIGHT); + width = fOptionStringView->StringWidth(fOptionStringView->Text()); + if (width > widest) + widest = width; + + fCommandStringView = new BStringView("command", + B_TRANSLATE_COMMENT("Command:", "Command key role name")); + fCommandStringView->SetAlignment(B_ALIGN_RIGHT); + width = fCommandStringView->StringWidth(fCommandStringView->Text()); + if (width > widest) + widest = width; + + // set the width of each of the string view's to the widest + fShiftStringView->SetExplicitMaxSize(BSize(widest, B_SIZE_UNSET)); + fControlStringView->SetExplicitMaxSize(BSize(widest, B_SIZE_UNSET)); + fOptionStringView->SetExplicitMaxSize(BSize(widest, B_SIZE_UNSET)); + fCommandStringView->SetExplicitMaxSize(BSize(widest, B_SIZE_UNSET)); + + fShiftConflictView = new ConflictView("shift warning view"); + fShiftConflictView->SetExplicitMaxSize(BSize(15, 15)); + + fControlConflictView = new ConflictView("control warning view"); + fControlConflictView->SetExplicitMaxSize(BSize(15, 15)); + + fOptionConflictView = new ConflictView("option warning view"); + fOptionConflictView->SetExplicitMaxSize(BSize(15, 15)); + + fCommandConflictView = new ConflictView("command warning view"); + fCommandConflictView->SetExplicitMaxSize(BSize(15, 15)); fCancelButton = new BButton("cancelButton", B_TRANSLATE("Cancel"), new BMessage(B_QUIT_REQUESTED)); @@ -87,7 +141,7 @@ ModifierKeysWindow::ModifierKeysWindow() new BMessage(kMsgRevertModifiers)); fRevertButton->SetEnabled(false); - fOkButton = new BButton("okButton", B_TRANSLATE("OK"), + fOkButton = new BButton("okButton", B_TRANSLATE("Set modifier keys"), new BMessage(kMsgApplyModifiers)); fOkButton->MakeDefault(true); @@ -96,20 +150,26 @@ ModifierKeysWindow::ModifierKeysWindow() AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) .Add(BGridLayoutBuilder(10, 10) - .Add(capsLockStringView, 0, 0) - .Add(_CreateCapsLockMenuField(), 1, 0) + .Add(keyRole, 0, 0) + .Add(keyLabel, 1, 0) - .Add(controlStringView, 0, 1) - .Add(_CreateControlMenuField(), 1, 1) + .Add(fShiftStringView, 0, 1) + .Add(_CreateShiftMenuField(), 1, 1) + .Add(fShiftConflictView, 2, 1) - .Add(optionStringView, 0, 2) - .Add(_CreateOptionMenuField(), 1, 2) + .Add(fControlStringView, 0, 2) + .Add(_CreateControlMenuField(), 1, 2) + .Add(fControlConflictView, 2, 2) - .Add(commandStringView, 0, 3) - .Add(_CreateCommandMenuField(), 1, 3) + .Add(fOptionStringView, 0, 3) + .Add(_CreateOptionMenuField(), 1, 3) + .Add(fOptionConflictView, 2, 3) + + .Add(fCommandStringView, 0, 4) + .Add(_CreateCommandMenuField(), 1, 4) + .Add(fCommandConflictView, 2, 4) ) .AddGlue() - .Add(fSwitchRight) .AddGroup(B_HORIZONTAL, 10) .Add(fCancelButton) .AddGlue() @@ -119,9 +179,8 @@ ModifierKeysWindow::ModifierKeysWindow() .SetInsets(10, 10, 10, 10) ); - // TODO: Figure out a way to set this based on current modifiers - kInitialSwitchRight = B_CONTROL_OFF; - fSwitchRight->SetValue(kInitialSwitchRight); + _MarkMenuItems(); + _ValidateDuplicateKeys(); CenterOnScreen(); } @@ -139,82 +198,69 @@ ModifierKeysWindow::MessageReceived(BMessage* message) switch (message->what) { case kMsgUpdateModifier: { - int32 menu = MENU_ITEM_CAPS_LOCK; + int32 menuitem = MENU_ITEM_SHIFT; int32 key = -1; - for (; menu <= MENU_ITEM_COMMAND; menu++) { - if (message->FindInt32(_KeyToString(menu), &key) == B_OK) + for (; menuitem <= MENU_ITEM_COMMAND; menuitem++) { + if (message->FindInt32(_KeyToString(menuitem), &key) == B_OK) break; } - if (key == -1) { - // No option was found, don't update + if (key == -1) return; - } - // Now 'menu' contains the menu we want to set and 'key' contains - // the option we want to set it to. + // menuitem contains the item we want to set + // key contains the item we want to set it to. - switch (menu) { - case MENU_ITEM_CAPS_LOCK: - fCurrentMap->caps_key = _KeyToKeyCode(key); - fCapsLockMenu->ItemAt(key)->SetMarked(true); + switch (menuitem) { + case MENU_ITEM_SHIFT: + fCurrentMap->left_shift_key = _KeyToKeyCode(key); + fCurrentMap->right_shift_key = _KeyToKeyCode(key, true); break; case MENU_ITEM_CONTROL: - fCurrentMap->left_control_key - = _KeyToKeyCode(key); - if (key != MENU_ITEM_CAPS_LOCK) { - fCurrentMap->right_control_key - = _KeyToKeyCode(key, true); - } - - fControlMenu->ItemAt(key)->SetMarked(true); + fCurrentMap->left_control_key = _KeyToKeyCode(key); + fCurrentMap->right_control_key = _KeyToKeyCode(key, true); break; case MENU_ITEM_OPTION: - fCurrentMap->left_option_key - = _KeyToKeyCode(key); - if (key != MENU_ITEM_CAPS_LOCK) { - fCurrentMap->right_option_key - = _KeyToKeyCode(key, true); - } - - fOptionMenu->ItemAt(key)->SetMarked(true); + fCurrentMap->left_option_key = _KeyToKeyCode(key); + fCurrentMap->right_option_key = _KeyToKeyCode(key, true); break; case MENU_ITEM_COMMAND: - fCurrentMap->left_command_key - = _KeyToKeyCode(key); - if (key != MENU_ITEM_CAPS_LOCK) { - fCurrentMap->right_command_key - = _KeyToKeyCode(key, true); - } - - fCommandMenu->ItemAt(key)->SetMarked(true); + fCurrentMap->left_command_key = _KeyToKeyCode(key); + fCurrentMap->right_command_key = _KeyToKeyCode(key, true); break; } + _MarkMenuItems(); + _ValidateDuplicateKeys(); + + // enable/disable revert button fRevertButton->SetEnabled( - kInitialSwitchRight != fSwitchRight->Value() - || memcmp(fCurrentMap, fSavedMap, sizeof(key_map))); + memcmp(fCurrentMap, fSavedMap, sizeof(key_map))); break; } // OK button case kMsgApplyModifiers: { - BMessage* updateModifiers = new BMessage(kMsgUpdateModifiers); + // if duplicate modifiers are found, don't update + if (_DuplicateKeys() != 0) + break; - if (fSwitchRight->Value() != kInitialSwitchRight) { - int32 rightOptionKey = fCurrentMap->right_option_key; - int32 rightCommandKey = fCurrentMap->right_command_key; - fCurrentMap->right_option_key = rightCommandKey; - fCurrentMap->right_command_key = rightOptionKey; + BMessage* updateModifiers = new BMessage(kMsgUpdateModifierKeys); + + if (fCurrentMap->left_shift_key != fSavedMap->left_shift_key) { + updateModifiers->AddUInt32("left_shift_key", + fCurrentMap->left_shift_key); } - if (fCurrentMap->caps_key != fSavedMap->caps_key) - updateModifiers->AddUInt32("caps_key", fCurrentMap->caps_key); + if (fCurrentMap->right_shift_key != fSavedMap->right_shift_key) { + updateModifiers->AddUInt32("right_shift_key", + fCurrentMap->right_shift_key); + } if (fCurrentMap->left_control_key != fSavedMap->left_control_key) { updateModifiers->AddUInt32("left_control_key", @@ -248,21 +294,21 @@ ModifierKeysWindow::MessageReceived(BMessage* message) fCurrentMap->right_command_key); } - // Tell KeymapWindow to update the modifier keys + // KeymapWindow updates the modifiers be_app->PostMessage(updateModifiers); - // We are done here, close the window + // we are done here, close the window this->PostMessage(B_QUIT_REQUESTED); break; } // Revert button case kMsgRevertModifiers: - fSwitchRight->SetValue(kInitialSwitchRight); - memcpy(fCurrentMap, fSavedMap, sizeof(key_map)); _MarkMenuItems(); + _ValidateDuplicateKeys(); + fRevertButton->SetEnabled(false); break; @@ -272,31 +318,34 @@ ModifierKeysWindow::MessageReceived(BMessage* message) } +// #pragma mark - + + BMenuField* -ModifierKeysWindow::_CreateCapsLockMenuField() +ModifierKeysWindow::_CreateShiftMenuField() { - fCapsLockMenu = new BPopUpMenu( - B_TRANSLATE(_KeyToString(MENU_ITEM_CAPS_LOCK)), true, true); + fShiftMenu = new BPopUpMenu( + B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_SHIFT)), true, true); - for (int32 key = MENU_ITEM_CAPS_LOCK; key <= MENU_ITEM_DISABLED; key++) { + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) { if (key == MENU_ITEM_SEPERATOR) { + // add separator item BSeparatorItem* separator = new BSeparatorItem; - fCapsLockMenu->AddItem(separator, key); - } else { - BMessage* message = new BMessage(kMsgUpdateModifier); - message->AddInt32(_KeyToString(MENU_ITEM_CAPS_LOCK), key); - - BMenuItem* item = new BMenuItem(B_TRANSLATE(_KeyToString(key)), - message); - - if (fCurrentMap->caps_key == _KeyToKeyCode(key)) - item->SetMarked(true); - - fCapsLockMenu->AddItem(item, key); + fShiftMenu->AddItem(separator, MENU_ITEM_SEPERATOR); + continue; } - } - return new BMenuField(NULL, fCapsLockMenu); + BMessage* message = new BMessage(kMsgUpdateModifier); + message->AddInt32(_KeyToString(MENU_ITEM_SHIFT), key); + BMenuItem* item = new BMenuItem( + B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message); + + fShiftMenu->AddItem(item, key); + } + fShiftMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, + B_ALIGN_VERTICAL_UNSET)); + + return new BMenuField(NULL, fShiftMenu); } @@ -304,21 +353,25 @@ BMenuField* ModifierKeysWindow::_CreateControlMenuField() { fControlMenu = new BPopUpMenu( - B_TRANSLATE(_KeyToString(MENU_ITEM_CONTROL)), true, true); + B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_CONTROL)), true, true); + + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) { + if (key == MENU_ITEM_SEPERATOR) { + // add separator item + BSeparatorItem* separator = new BSeparatorItem; + fControlMenu->AddItem(separator, MENU_ITEM_SEPERATOR); + continue; + } - for (int32 key = MENU_ITEM_CAPS_LOCK; key <= MENU_ITEM_COMMAND; key++) { BMessage* message = new BMessage(kMsgUpdateModifier); message->AddInt32(_KeyToString(MENU_ITEM_CONTROL), key); - - BMenuItem* item = new BMenuItem(B_TRANSLATE(_KeyToString(key)), - message); - - if (fCurrentMap->left_control_key == _KeyToKeyCode(key) - && fCurrentMap->right_control_key == _KeyToKeyCode(key, true)) - item->SetMarked(true); + BMenuItem* item = new BMenuItem( + B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message); fControlMenu->AddItem(item, key); } + fControlMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, + B_ALIGN_VERTICAL_UNSET)); return new BMenuField(NULL, fControlMenu); } @@ -328,20 +381,25 @@ BMenuField* ModifierKeysWindow::_CreateOptionMenuField() { fOptionMenu = new BPopUpMenu( - B_TRANSLATE(_KeyToString(MENU_ITEM_OPTION)), true, true); + B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_OPTION)), true, true); + + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) { + if (key == MENU_ITEM_SEPERATOR) { + // add separator item + BSeparatorItem* separator = new BSeparatorItem; + fOptionMenu->AddItem(separator, MENU_ITEM_SEPERATOR); + continue; + } - for (int32 key = MENU_ITEM_CAPS_LOCK; key <= MENU_ITEM_COMMAND; key++) { BMessage* message = new BMessage(kMsgUpdateModifier); message->AddInt32(_KeyToString(MENU_ITEM_OPTION), key); - - BMenuItem* item = new BMenuItem(B_TRANSLATE(_KeyToString(key)), - message); - - if (fCurrentMap->left_option_key == _KeyToKeyCode(key)) - item->SetMarked(true); + BMenuItem* item = new BMenuItem( + B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message); fOptionMenu->AddItem(item, key); } + fOptionMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, + B_ALIGN_VERTICAL_UNSET)); return new BMenuField(NULL, fOptionMenu); } @@ -351,20 +409,24 @@ BMenuField* ModifierKeysWindow::_CreateCommandMenuField() { fCommandMenu = new BPopUpMenu( - B_TRANSLATE(_KeyToString(MENU_ITEM_COMMAND)), true, true); + B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_COMMAND)), true, true); + + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) { + if (key == MENU_ITEM_SEPERATOR) { + // add separator item + BSeparatorItem* separator = new BSeparatorItem; + fCommandMenu->AddItem(separator, MENU_ITEM_SEPERATOR); + continue; + } - for (int32 key = MENU_ITEM_CAPS_LOCK; key <= MENU_ITEM_COMMAND; key++) { BMessage* message = new BMessage(kMsgUpdateModifier); message->AddInt32(_KeyToString(MENU_ITEM_COMMAND), key); - - BMenuItem* item = new BMenuItem(B_TRANSLATE(_KeyToString(key)), - message); - - if (fCurrentMap->left_command_key == _KeyToKeyCode(key)) - item->SetMarked(true); - + BMenuItem* item = new BMenuItem( + B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message); fCommandMenu->AddItem(item, key); } + fCommandMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, + B_ALIGN_VERTICAL_UNSET)); return new BMenuField(NULL, fCommandMenu); } @@ -373,70 +435,372 @@ ModifierKeysWindow::_CreateCommandMenuField() void ModifierKeysWindow::_MarkMenuItems() { - for (int32 key = MENU_ITEM_CAPS_LOCK; key <= MENU_ITEM_COMMAND; key++) { - if (fCurrentMap->caps_key == _KeyToKeyCode(key)) - fCapsLockMenu->ItemAt(key)->SetMarked(true); + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) { + if (key == MENU_ITEM_SEPERATOR) + continue; + + if (fCurrentMap->left_shift_key == _KeyToKeyCode(key) + && fCurrentMap->right_shift_key == _KeyToKeyCode(key, true)) { + fShiftMenu->ItemAt(key)->SetMarked(true); + + if (key == MENU_ITEM_DISABLED) + fShiftStringView->SetHighColor(disabledColor); + else + fShiftStringView->SetHighColor(normalColor); + + fShiftStringView->Invalidate(); + } if (fCurrentMap->left_control_key == _KeyToKeyCode(key) - && fCurrentMap->right_control_key == _KeyToKeyCode(key, true)) + && fCurrentMap->right_control_key == _KeyToKeyCode(key, true)) { fControlMenu->ItemAt(key)->SetMarked(true); + if (key == MENU_ITEM_DISABLED) + fControlStringView->SetHighColor(disabledColor); + else + fControlStringView->SetHighColor(normalColor); + + fControlStringView->Invalidate(); + } + if (fCurrentMap->left_option_key == _KeyToKeyCode(key) - && fCurrentMap->right_option_key == _KeyToKeyCode(key, true)) + && fCurrentMap->right_option_key == _KeyToKeyCode(key, true)) { fOptionMenu->ItemAt(key)->SetMarked(true); - if (fCurrentMap->left_command_key == _KeyToKeyCode(key) - && fCurrentMap->right_command_key == _KeyToKeyCode(key, true)) - fCommandMenu->ItemAt(key)->SetMarked(true); - } + if (key == MENU_ITEM_DISABLED) + fOptionStringView->SetHighColor(disabledColor); + else + fOptionStringView->SetHighColor(normalColor); - // Check if caps lock is disabled - if (fCurrentMap->caps_key == _KeyToKeyCode(MENU_ITEM_DISABLED)) - fCapsLockMenu->ItemAt(MENU_ITEM_DISABLED)->SetMarked(true); + fOptionStringView->Invalidate(); + } + + if (fCurrentMap->left_command_key == _KeyToKeyCode(key) + && fCurrentMap->right_command_key == _KeyToKeyCode(key, true)) { + fCommandMenu->ItemAt(key)->SetMarked(true); + + if (key == MENU_ITEM_DISABLED) + fCommandStringView->SetHighColor(disabledColor); + else + fCommandStringView->SetHighColor(normalColor); + + fCommandStringView->Invalidate(); + } + } } +// get the string for a modifier key const char* ModifierKeysWindow::_KeyToString(int32 key) { switch (key) { - case MENU_ITEM_CAPS_LOCK: - return "Caps Lock"; + case MENU_ITEM_SHIFT: + return B_TRANSLATE_COMMENT("Shift key", + "Label of key above Ctrl, usually Shift"); + case MENU_ITEM_CONTROL: - return "Control"; + return B_TRANSLATE_COMMENT("Ctrl key", + "Label of key farthest from the spacebar, usually Ctrl" + "e.g. Strg for German keyboard"); + case MENU_ITEM_OPTION: - return "Option"; + return B_TRANSLATE_COMMENT("Win/Cmd key", + "Label of the \"Windows\" key (PC)/Command key (Mac)"); + case MENU_ITEM_COMMAND: - return "Command"; + return B_TRANSLATE_COMMENT("Alt/Opt key", + "Label of Alt key (PC)/Option key (Mac)"); + case MENU_ITEM_DISABLED: - return "Disabled"; + return B_TRANSLATE_COMMENT("Disabled", "Do nothing"); } return ""; } +// get the keycode for a modifier key uint32 ModifierKeysWindow::_KeyToKeyCode(int32 key, bool right) { switch (key) { - case MENU_ITEM_CAPS_LOCK: - return 0x3b; + case MENU_ITEM_SHIFT: + if (right) + return 0x56; + return 0x4b; + case MENU_ITEM_CONTROL: if (right) return 0x60; return 0x5c; + case MENU_ITEM_OPTION: if (right) return 0x67; return 0x66; + case MENU_ITEM_COMMAND: if (right) return 0x5f; return 0x5d; + case MENU_ITEM_DISABLED: return 0; } return 0; } + + +// validate duplicate keys +void +ModifierKeysWindow::_ValidateDuplicateKeys() +{ + uint32 dupMask = _DuplicateKeys(); + + BBitmap* shiftIcon = fShiftConflictView->Icon(); + BBitmap* controlIcon = fControlConflictView->Icon(); + BBitmap* optionIcon = fOptionConflictView->Icon(); + BBitmap* commandIcon = fCommandConflictView->Icon(); + + if (dupMask != 0) { + fShiftConflictView->ShowIcon((dupMask & SHIFT_KEY) != 0); + fControlConflictView->ShowIcon((dupMask & CONTROL_KEY) != 0); + fOptionConflictView->ShowIcon((dupMask & OPTION_KEY) != 0); + fCommandConflictView->ShowIcon((dupMask & COMMAND_KEY) != 0); + + fOkButton->SetEnabled(false); + } else { + fShiftConflictView->ShowIcon(false); + fControlConflictView->ShowIcon(false); + fOptionConflictView->ShowIcon(false); + fCommandConflictView->ShowIcon(false); + + fOkButton->SetEnabled(true); + } + + // if there was a change invalidate the view + if (shiftIcon != fShiftConflictView->Icon()) + fShiftConflictView->Invalidate(); + + if (controlIcon != fControlConflictView->Icon()) + fControlConflictView->Invalidate(); + + if (optionIcon != fOptionConflictView->Icon()) + fOptionConflictView->Invalidate(); + + if (commandIcon != fCommandConflictView->Icon()) + fCommandConflictView->Invalidate(); +} + + +// return a mask marking which keys are duplicates of each other for +// validation. Control = 1, Option = 2, Command = 3 +uint32 +ModifierKeysWindow::_DuplicateKeys() +{ + uint32 duplicateMask = 0; + + for (int32 testKey = MENU_ITEM_SHIFT; testKey <= MENU_ITEM_COMMAND; + testKey++) { + uint32 testLeft = 0; + uint32 testRight = 0; + + switch (testKey) { + case MENU_ITEM_SHIFT: + testLeft = fCurrentMap->left_shift_key; + testRight = fCurrentMap->right_shift_key; + break; + + case MENU_ITEM_CONTROL: + testLeft = fCurrentMap->left_control_key; + testRight = fCurrentMap->right_control_key; + break; + + case MENU_ITEM_OPTION: + testLeft = fCurrentMap->left_option_key; + testRight = fCurrentMap->right_option_key; + break; + + case MENU_ITEM_COMMAND: + testLeft = fCurrentMap->left_command_key; + testRight = fCurrentMap->right_command_key; + break; + } + + if (testLeft == 0 && testRight == 0) + continue; + + for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_COMMAND; key++) { + if (key == testKey) { + // skip over yourself + continue; + } + + uint32 left = 0; + uint32 right = 0; + + switch(key) { + case MENU_ITEM_SHIFT: + left = fCurrentMap->left_shift_key; + right = fCurrentMap->right_shift_key; + break; + + case MENU_ITEM_CONTROL: + left = fCurrentMap->left_control_key; + right = fCurrentMap->right_control_key; + break; + + case MENU_ITEM_OPTION: + left = fCurrentMap->left_option_key; + right = fCurrentMap->right_option_key; + break; + + case MENU_ITEM_COMMAND: + left = fCurrentMap->left_command_key; + right = fCurrentMap->right_command_key; + break; + } + + if (left == 0 && right == 0) + continue; + + if (left == testLeft && right == testRight) { + duplicateMask |= 1 << testKey; + duplicateMask |= 1 << key; + } + } + } + + return duplicateMask; +} + + +// #pragma mark - ConflictView + + +ConflictView::ConflictView(const char* name) + : + BView(BRect(0, 0, 15, 15), name, B_FOLLOW_NONE, B_WILL_DRAW), + fIcon(NULL), + fSavedIcon(NULL) +{ + _FillSavedIcon(); +} + + +ConflictView::~ConflictView() +{ + delete fSavedIcon; +} + + +void +ConflictView::Draw(BRect updateRect) +{ + // Draw background + + if (Parent()) + SetLowColor(Parent()->ViewColor()); + else + SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + FillRect(updateRect, B_SOLID_LOW); + + // Draw icon + if (fIcon == NULL) + return; + + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); + DrawBitmapAsync(fIcon, BPoint(0, 0)); +} + + +// get the icon +BBitmap* +ConflictView::Icon() +{ + return fIcon; +} + + +// show or hide the icon +void +ConflictView::ShowIcon(bool show) +{ + if (show) + fIcon = fSavedIcon; + else + fIcon = NULL; +} + + +// #pragma mark - + + +// fill out the icon with the stop symbol from app_server +void +ConflictView::_FillSavedIcon() +{ + // return if the fSavedIcon has already been filled out + if (fSavedIcon != NULL && fSavedIcon->InitCheck() == B_OK) + return; + + BPath path; + status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path); + if (status < B_OK) { + FTRACE((stderr, + "_FillWarningIcon() - find_directory failed: %s\n", + strerror(status))); + delete fSavedIcon; + fSavedIcon = NULL; + return; + } + + path.Append("app_server"); + BFile file; + status = file.SetTo(path.Path(), B_READ_ONLY); + if (status < B_OK) { + FTRACE((stderr, + "_FillWarningIcon() - BFile init failed: %s\n", + strerror(status))); + delete fSavedIcon; + fSavedIcon = NULL; + return; + } + + BResources resources; + status = resources.SetTo(&file); + if (status < B_OK) { + FTRACE((stderr, + "_WarningIcon() - BResources init failed: %s\n", + strerror(status))); + delete fSavedIcon; + fSavedIcon = NULL; + return; + } + + // Allocate the fSavedIcon bitmap + fSavedIcon = new(std::nothrow) BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32); + if (fSavedIcon->InitCheck() < B_OK) { + FTRACE((stderr, "_WarningIcon() - No memory for warning bitmap\n")); + delete fSavedIcon; + fSavedIcon = NULL; + return; + } + + // Load the raw stop icon data + size_t size = 0; + const uint8* rawIcon; + rawIcon = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, + "stop", &size); + + // load vector warning icon into fSavedIcon + if (rawIcon == NULL + || BIconUtils::GetVectorIcon(rawIcon, size, fSavedIcon) < B_OK) { + delete fSavedIcon; + fSavedIcon = NULL; + } +} diff --git a/src/preferences/keymap/ModifierKeysWindow.h b/src/preferences/keymap/ModifierKeysWindow.h index b8645b5c66..a8200eb303 100644 --- a/src/preferences/keymap/ModifierKeysWindow.h +++ b/src/preferences/keymap/ModifierKeysWindow.h @@ -9,48 +9,81 @@ #define MODIFIER_KEYS_WINDOW_H +#include #include #include #include #include #include +#include #include +class ConflictView; + class ModifierKeysWindow : public BWindow { public: - ModifierKeysWindow(); - virtual ~ModifierKeysWindow(); + ModifierKeysWindow(); + virtual ~ModifierKeysWindow(); - virtual void MessageReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); protected: - BMenuField* _CreateCapsLockMenuField(); - BMenuField* _CreateControlMenuField(); - BMenuField* _CreateOptionMenuField(); - BMenuField* _CreateCommandMenuField(); - - void _MarkMenuItems(); - const char* _KeyToString(int32 key); - uint32 _KeyToKeyCode(int32 key, bool right = false); + BMenuField* _CreateShiftMenuField(); + BMenuField* _CreateControlMenuField(); + BMenuField* _CreateOptionMenuField(); + BMenuField* _CreateCommandMenuField(); -private: - BPopUpMenu* fCapsLockMenu; - BPopUpMenu* fControlMenu; - BPopUpMenu* fOptionMenu; - BPopUpMenu* fCommandMenu; + void _MarkMenuItems(); + const char* _KeyToString(int32 key); + uint32 _KeyToKeyCode(int32 key, + bool right = false); + int32 _LastKey(); + void _ValidateDuplicateKeys(); + uint32 _DuplicateKeys(); - BCheckBox* fSwitchRight; +private: + BStringView* fShiftStringView; + BStringView* fControlStringView; + BStringView* fOptionStringView; + BStringView* fCommandStringView; - BButton* fRevertButton; - BButton* fCancelButton; - BButton* fOkButton; - - key_map* fCurrentMap; - key_map* fSavedMap; - - char* fCurrentBuffer; - char* fSavedBuffer; + BPopUpMenu* fShiftMenu; + BPopUpMenu* fControlMenu; + BPopUpMenu* fOptionMenu; + BPopUpMenu* fCommandMenu; + + ConflictView* fShiftConflictView; + ConflictView* fControlConflictView; + ConflictView* fOptionConflictView; + ConflictView* fCommandConflictView; + + BButton* fRevertButton; + BButton* fCancelButton; + BButton* fOkButton; + + key_map* fCurrentMap; + key_map* fSavedMap; + + char* fCurrentBuffer; + char* fSavedBuffer; +}; + + +class ConflictView : public BView { + public: + ConflictView(const char* name); + ~ConflictView(); + BBitmap* Icon(); + void ShowIcon(bool show); + + protected: + virtual void Draw(BRect updateRect); + void _FillSavedIcon(); + + private: + BBitmap* fIcon; + BBitmap* fSavedIcon; }; diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 2e57d6ad3c..685c548d4e 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -272,7 +272,7 @@ InputServer::_LoadKeymap() if (file.Read(&fKeys, sizeof(fKeys)) < (ssize_t)sizeof(fKeys)) return B_BAD_VALUE; - for (uint32 i = 0; i < sizeof(fKeys)/4; i++) + for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) ((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]); if (file.Read(&fCharsSize, sizeof(uint32)) < (ssize_t)sizeof(uint32))