mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
include/nuttx/input: add modifier keycodes to the keyboard codec
A keyboard driver that tracks modifier state has no way to report it. Folding the modifier into the character that it produces loses the fact that the key is down, so an application cannot bind an action to Ctrl or Shift, and cannot tell that one is being held. Add the eight modifiers to enum kbd_keycode_e and move LAST_KEYCODE to the new end of the enumeration. Leaving LAST_KEYCODE behind would make kbd_specpress() assert and kbd_decode() reject the new keycodes, since both range check against it. The keycodes are appended, so the values of the existing ones do not change. Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit is contained in:
parent
d960bc39ee
commit
75c0e29774
1 changed files with 19 additions and 2 deletions
|
|
@ -166,11 +166,28 @@ enum kbd_keycode_e
|
|||
KEYCODE_F21, /* Function key 21 */
|
||||
KEYCODE_F22, /* Function key 22 */
|
||||
KEYCODE_F23, /* Function key 23 */
|
||||
KEYCODE_F24 /* Function key 24 */
|
||||
KEYCODE_F24, /* Function key 24 */
|
||||
|
||||
/* Modifier keys. Drivers that are able to track modifier state (a USB
|
||||
* HID keyboard, for example) may report these as key press and key
|
||||
* release events in their own right. That allows an application to bind
|
||||
* an action to a modifier, or to know that a modifier is being held down,
|
||||
* which cannot be expressed by folding the modifier into the character
|
||||
* that it produces.
|
||||
*/
|
||||
|
||||
KEYCODE_LCTRL, /* Left Ctrl */
|
||||
KEYCODE_RCTRL, /* Right Ctrl */
|
||||
KEYCODE_LSHIFT, /* Left Shift */
|
||||
KEYCODE_RSHIFT, /* Right Shift */
|
||||
KEYCODE_LALT, /* Left Alt */
|
||||
KEYCODE_RALT, /* Right Alt */
|
||||
KEYCODE_LGUI, /* Left GUI (Windows/Command) */
|
||||
KEYCODE_RGUI /* Right GUI (Windows/Command) */
|
||||
};
|
||||
|
||||
#define FIRST_KEYCODE KEYCODE_FWDDEL
|
||||
#define LAST_KEYCODE KEYCODE_F24
|
||||
#define LAST_KEYCODE KEYCODE_RGUI
|
||||
|
||||
/* kbd_decode() return values */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue