input: fix KEY_power key code conflict with japanese \_ key

- This key code is inherited from BeOS, where it was used for the power
  key on Apple ADB keyboards
- Since then, we have introduced a new system for "multimedia" keys,
  that uses HID key codes directly instead of defining our own mappings
- The PS2 driver was using the HID keycode, but the USB driver was still
  using the BeOS defined one
- Japanese keyboards, which have a few more keys than US and European
  ones, reused the same keycode for something else

Since the power key does not need to be mapped by the keymap, move it
out of the way by using the HID keycode (key codes larger than 0x7f
cannot be mapped to UTF8 symbols). Remove all mentions of the use of
0x6b as a keycode for the power key, but add a note in the documentation
that BeOS did this.

To avoid further confusions, complete the documentation of extra
keycodes, and remove some definitions from keyboard_mouse_driver.h that
should have been in InterfaceDefs.h.

While researching this, I also found that some keys specific to Korean
keyboards were declared in the wrong place, as mapped codes instead of
unmapped ones (checked that by looking at the HID driver, which emits
these raw keycodes, and confirming that the mapped ones are not used in
any keymaps. Also added a note about the mapping of the extra modifier
keys in Japanese keyboards, which I think may be a problem since these
map to invalid UTF-8 byte sequences, but this is what the existing
keymap does, so leaving it as is for now until we can determine if this
can be changed or if we have to keep it that way.

Change-Id: I6a198a0840cba7739bdc78e0c65e5d8fd23956c9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8047
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
X512
2024-08-19 16:00:25 +00:00
committed by waddlesplash
parent d4b18b5602
commit 2141d2fe3a
72 changed files with 63 additions and 115 deletions
+10 -4
View File
@@ -63,11 +63,10 @@ enum {
B_FUNCTION_KEY = 0x10,
// for Japanese and Korean keyboards
// For Japanese keyboards, two modifier keys are mapped to invalid UTF-8, with just a single
// byte having the 8th bit set.
B_KATAKANA_HIRAGANA = 0xf2,
B_HANKAKU_ZENKAKU = 0xf3,
B_HANGUL = 0xf0,
B_HANGUL_HANJA = 0xf1
};
enum {
@@ -85,7 +84,14 @@ enum {
B_F12_KEY = 0x0d,
B_PRINT_KEY = 0x0e,
B_SCROLL_KEY = 0x0f,
B_PAUSE_KEY = 0x10
B_PAUSE_KEY = 0x10,
B_NUM_LOCK_KEY = 0x22,
B_CAPS_LOCK_KEY = 0x3b,
B_SPACE_BAR_KEY = 0x5e,
B_NUMPAD_EQUAL_KEY = 0x6a,
// For Korean keyboards
B_HANGUL_KEY = 0xf0,
B_HANGUL_HANJA_KEY = 0xf1
};
struct key_map {
@@ -10,10 +10,9 @@
#include <Drivers.h>
#define KEY_Scroll 0x0f
#define KEY_Pause 0x10
#define KEY_Num 0x22
#define KEY_CapsLock 0x3b
// FIXME: these should go in InterfaceDefs.h (in the same enum as B_F1_KEY), but the names would
// clash with names in the modifiers enum also defined there, so we would need to first rename the
// values in the modifiers enumeration.
#define KEY_ShiftL 0x4b
#define KEY_ShiftR 0x56
#define KEY_ControlL 0x5c
@@ -27,11 +26,8 @@
#define KEY_OptR 0x67
#define KEY_WinR 0x67
#define KEY_Menu 0x68
#define KEY_NumEqual 0x6a
#define KEY_Power 0x6b
#define KEY_SysRq 0x7e
#define KEY_Break 0x7f
#define KEY_Spacebar 0x5e
#define KB_DEFAULT_CONTROL_ALT_DEL_TIMEOUT 4000000