w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
148 stars 51 forks source link

Proposal key names for Android #9

Closed garykac closed 9 years ago

garykac commented 9 years ago

Copied from W3C Bugzilla: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21083

Masayuki Nakano 2013-02-22 09:23:52 UTC

I'm trying to implement KeyboardEvent.key value for non-printable keys on Android. Then, following native keys cannot be mapped to the key names in the list (http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#key-values-list):

And for game pad:

KEYCODE_BUTTON_A: KEYCODE_BUTTON_B: KEYCODE_BUTTON_C: KEYCODE_BUTTON_X: KEYCODE_BUTTON_Y: KEYCODE_BUTTON_Z: KEYCODE_BUTTON_L1: KEYCODE_BUTTON_R1: KEYCODE_BUTTON_L2: KEYCODE_BUTTON_R2: KEYCODE_THUMBL: KEYCODE_THUMBR: KEYCODE_BUTTON_START: KEYCODE_BUTTON_SELECT: KEYCODE_BUTTON_MODE:
KEYCODE_BUTTON_1: KEYCODE_BUTTON_2: KEYCODE_BUTTON_3: KEYCODE_BUTTON_4: KEYCODE_BUTTON_5: KEYCODE_BUTTON_6: KEYCODE_BUTTON_7: KEYCODE_BUTTON_8: KEYCODE_BUTTON_9: KEYCODE_BUTTON_10: KEYCODE_BUTTON_11: KEYCODE_BUTTON_12: KEYCODE_BUTTON_13: KEYCODE_BUTTON_14: KEYCODE_BUTTON_15: KEYCODE_BUTTON_16:

'GamePadButtonA'..., 'GamePadThumbLeft', 'GamePadThumbRight', 'GamePadButton1"?

Comment 1 Masayuki Nakano 2013-02-22 09:24:37 UTC

Oops, the document of Android is here: http://developer.android.com/reference/android/view/KeyEvent.html

Comment 2 Masayuki Nakano 2013-02-23 02:21:53 UTC

(In reply to comment #0)

KEYCODE_THUMBL: KEYCODE_THUMBR:

They are:

KEYCODE_BUTTON_THUMBL: KEYCODE_BUTTON_THUMBR:

Then, the names are:

'GamePadButtonThumbLeft', 'GamePadButtonThumbRight'?

Comment 3 Gary Kacmarcik 2013-02-26 05:41:45 UTC

I'm not sure it makes sense to maps these values to 'key' or 'char'.

The documentation states: "Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap associated with the input device when mapping keys to characters."

This sounds more like a 'code' value and some of the names (like KEYCODE_ZENKAKU_HANKAKU and KEYCODE_KATAKANA_HIRAGANA) are consistent with this interpretation.

To get a key/char, it looks like you'd need to pass the code value to the KeyCharacterMap (http://developer.android.com/reference/android/view/KeyCharacterMap.html) rather than using these codes directly.

Comment 4 Masayuki Nakano 2013-02-26 05:59:17 UTC

Gary:

I'm talking about non-printable keys. Looks like getDisplayLabel() returns null if the key is non-printable. http://developer.android.com/reference/android/view/KeyCharacterMap.html#getDisplayLabel%28int%29

Comment 5 Masayuki Nakano 2013-02-27 02:36:57 UTC

I separated following key definition to bug 21121:

  • KEYCODE_CALL: 'PhoneCall' as Device key?
  • KEYCODE_* KEYCODE_MANNER_MODE: 'ToggleMannerMode', 'SwitchMannerMode' or just 'MannerMode' as Device key?
  • ENDCALL: 'PhoneEndCall' as Device key?
  • KEYCODE_CONTACTS: 'LaunchAddressBook' as General key?

I separated following key definition to bug 21120:

  • KEYCODE_TV: Perhaps, 'Live'? But I think that 'TV' as Media key is better.
  • KEYCODE_DVR: 'DVR' or 'VideoRecorder' as Media key?
  • KEYCODE_TV_POWER: 'TVPower' as Media key?
  • KEYCODE_TV_INPUT: 'TVSelectInput' as Media key?
  • KEYCODE_STB_POWER: 'STBPower' as Media key?
  • KEYCODE_STB_INPUT: 'STBSelectInput' as Media key?
  • KEYCODE_AVR_POWER: 'AVReceiverPower' as Media key?
  • KEYCODE_AVR_INPUT: 'AVReceiverSelectInput' as Media key?
  • KEYCODE_3D_MODE: 'Toggle3DMode' as Media key?

I separated following key definition to bug 21119:

  • KEYCODE_ZOOM_IN: 'ZoomIn' as UI?
  • KEYCODE_ZOOM_OUT: 'ZoomOut' as UI?

    Comment 6 Masayuki Nakano 2013-02-27 03:57:50 UTC

    I separated following key definition to bug 21136:

  • KEYCODE_HOME: Perhaps, 'Exit'? The key name is 'Home' but it exits active application and moves to home screen.
  • KEYCODE_BACK: 'Back' as UI key? It's not only used for browser's 'back'.

I separated following key definition to bug 21135:

  • KEYCODE_SYM: 'Symbol' as Modifier key? The Android document says this is a modifier, but D3E defines only 'SymbolLock'.

I separated following key definition to bug 21134:

  • KEYCODE_CONTACTS: 'LaunchAddressBook' as General key?
  • KEYCODE_MUSIC: 'LaunchMusicPlayer' as General key?
  • KEYCODE_CALCULATOR: 'LaunchCalculator' as General key?
    Comment 7 Masayuki Nakano 2013-02-27 06:13:08 UTC

I separated the game pad related keys definition to bug 21137.

Comment 8 Masayuki Nakano 2013-02-27 06:47:59 UTC

I filed bug 21139 for

  • KEYCODE_ZENKAKU_HANKAKU: 'ToggleWidth' as IME key? Both 'FullWidth' and 'HalfWidth' are not useful for this.
  • KEYCODE_KATAKANA_HIRAGANA: 'ToggleKatakanaHiragana' as IME key? 'Katakana' and 'Hiragana' key are not useful for this.

And I filed bug 21083 for

  • KEYCODE_PICTSYMBOLS: 'PictureSymbolMode' as IME key?
  • KEYCODE_LANGUAGE_SWITCH: 'ToggleLanguage' or 'SwitchLanguage' as IME key?

Then, remaining issues here are:

garykac commented 9 years ago

This issue was moved to w3c/DOM-Level-3-Events-key#6