Keymap changes from recent activity. No AltGr yet.

Below is a mostly complete summary of the changes in this commit.

* Set the DeadKeys for the US-International Keymap to use the Option map.
* Rename American keymap to US
* Update the US, US-International, and United-Kingdom keymaps to take
  out unneeded spaces in the option layer. Also updated the dead keys
  and some other keys on the US-International keyboard to use UTF-8
  characters rather than there ASCII equivalents when different.
* Make the Option key fall-through when there is no mapping in the Option
  table. Option is for special characters, if none, print the regular one.
  This is mostly meant for the US keymap which has an empty option map. But
  also so that you don't have to repeat the normal, shift, and caps maps in
  the option map needlessly. Although the keymaps are still not empty in
  some cases that it could be like numpad keys and space.
* Update the /bin/keymap app to use fputs() instead of printf() when there
  is no actual formatting taking place. I've gotten into trouble for doing
  this before and it is faster to not process the string unnecessarily.
* Also several 80-char limit style fixes and updated comments.
* In Keymap class Reorder the modifier keys to match the keymap files.
  Put B_CONTROL_KEY check above B_OPTION_KEY. Neither change has any effect,
  they are purely aesthetic.
* Update DumpKeymap() method to use the abbreviated modifier letters so it
  will fit in your 80-char wide terminal.
* Tiny style fix in InputServer
* 80-char limit style fix in BWindow and add a comment that the shortcut
  gets eaten in the case of Cmd+Q
* Implement IndexForModifier() in KeyboardLayout, although I am not using it.
* Take Caps Lock out of the Modifier keys window because I couldn't get
  it to work the way I wanted it to.
* Move key roles to the left column, and the key label on the left. Add column
  header labels. Thanks Rimas!
* Add validation and improve marking menu options. Add a 'Disabled' option
  to control, option, and command menus to disable the key. Make the key
  role text grey if the key roles is disabled. Validation ensures that you
  cannot repeat the same key twice in the Modifier keys window since that
  won't work. You can't define 2 sets of option keys even if you really want
  to. You can disable your control, option, and command keys if you
  want, but that is not recommended.
* Rename kUpdateModifiers to kUpdateModifierKeys message to differetiate
  it from kUpdateModifier.
* Add shift key to Modifier keys window, use the stop icon instead of the
  warning icon to indicate conflicts.
* Allow the Layout system to control the size of the Modifier keys window
  again, set the width's of the key role lables to the widest, set the width
  of the menu fields to take up the rest of the space minus room for the
  conflict views. I didn't like it that the Modifier keys window would change
  size based on what options you had selected in the menu fields. Now it
  doesn't, but, the layout system still makes it all fit.
This commit is contained in:
John Scipione
2012-04-06 02:42:54 -04:00
parent c83bde410a
commit 3cee15aac2
15 changed files with 1016 additions and 518 deletions
+21 -9
View File
@@ -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, [email protected].
* John Scipione, [email protected].
*/
@@ -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;