[uievents] Define key names for game controller of Android (#13)

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

##### Masayuki Nakano 2013-02-27 04:28:09 UTC
Android defines following key code values. For them, D3E should define the key names.

Android                 Suggestions

KEYCODE_BUTTON_A        'GameButtonA' as Game
KEYCODE_BUTTON_B        'GameButtonB'
KEYCODE_BUTTON_C        'GameButtonC'
KEYCODE_BUTTON_X        'GameButtonX'
KEYCODE_BUTTON_Y        'GameButtonY'
KEYCODE_BUTTON_Z        'GameButtonZ'
KEYCODE_BUTTON_L1       'GameButtonL1'
KEYCODE_BUTTON_R1       'GameButtonR1'
KEYCODE_BUTTON_L2       'GameButtonL2'
KEYCODE_BUTTON_R2       'GameButtonR2'
KEYCODE_BUTTON_THUMBL   'GameButtonThumbL'
KEYCODE_BUTTON_THUMBR   'GameButtonThumbR'
KEYCODE_BUTTON_START    'GameButtonStart'
KEYCODE_BUTTON_SELECT   'GameButtonSelect'
KEYCODE_BUTTON_MODE     'GameButtonMode'
KEYCODE_BUTTON_1        'GameButton1'
KEYCODE_BUTTON_2        'GameButton2'
KEYCODE_BUTTON_3        'GameButton3'
KEYCODE_BUTTON_4        'GameButton4'
KEYCODE_BUTTON_5        'GameButton5'
KEYCODE_BUTTON_6        'GameButton6'
KEYCODE_BUTTON_7        'GameButton7'
KEYCODE_BUTTON_8        'GameButton8'
KEYCODE_BUTTON_9        'GameButton9'
KEYCODE_BUTTON_10       'GameButton10'
KEYCODE_BUTTON_11       'GameButton11'
KEYCODE_BUTTON_12       'GameButton12'
KEYCODE_BUTTON_13       'GameButton13'
KEYCODE_BUTTON_14       'GameButton14'
KEYCODE_BUTTON_15       'GameButton15'
KEYCODE_BUTTON_16       'GameButton16'

##### Comment 1 Glenn Maynard 2013-02-27 04:52:20 UTC
I can't even tell what you're trying to do here.  No web API should be trying to define every input symbol of every random API in the industry.

##### Comment 2 Masayuki Nakano 2013-02-27 06:05:30 UTC
(In reply to comment #1)
> I can't even tell what you're trying to do here.  No web API should be
> trying to define every input symbol of every random API in the industry.


I believe that D3E spec should define key names which will be used in major platforms as far as possible because if it wouldn't define them clearly, it'd be possible each UA vendors to give different names for same key.

If this is wrong, the ".key" approach is failure since it allows different key names, which means ".key" is not web developer friendly.

##### Comment 3 Glenn Maynard 2013-03-05 00:35:21 UTC
(In reply to comment #2)
> I believe that D3E spec should define key names which will be used in major
> platforms as far as possible because if it wouldn't define them clearly,
> it'd be possible each UA vendors to give different names for same key.
> 
> If this is wrong, the ".key" approach is failure since it allows different
> key names, which means ".key" is not web developer friendly.


What does "GameButtonX" mean?  On a PSX controller, the button labelled "X" is in the bottom-left, and is usually a primary control.  On a 360 controller, it's the top-left button and is usually a secondary input.  On whatever input device Android is exposing, it might mean something completely different.  Saying that "GameButtonX" maps to "KEYCODE_BUTTON_X on Android" doesn't give a useful definition on anything that isn't Android.

Being told "the user pressed GameButtonY" doesn't tell the web developer anything.  It doesn't even mean "pushed a button with a Y on it"--it might be a controller with PSX labels, which has symbols rather than letters.

(For that matter, why are gamepad controllers being mapped like keys?  They should be exposed with a joystick API, not generate key events.)

##### Comment 4 Masayuki Nakano 2013-03-05 01:57:10 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > I believe that D3E spec should define key names which will be used in major
> > platforms as far as possible because if it wouldn't define them clearly,
> > it'd be possible each UA vendors to give different names for same key.
> > 
> > If this is wrong, the ".key" approach is failure since it allows different
> > key names, which means ".key" is not web developer friendly.
> 
> What does "GameButtonX" mean?  On a PSX controller, the button labelled "X"
> is in the bottom-left, and is usually a primary control.  On a 360
> controller, it's the top-left button and is usually a secondary input.  On
> whatever input device Android is exposing, it might mean something
> completely different.  Saying that "GameButtonX" maps to "KEYCODE_BUTTON_X
> on Android" doesn't give a useful definition on anything that isn't Android.
> 
> Being told "the user pressed GameButtonY" doesn't tell the web developer
> anything.  It doesn't even mean "pushed a button with a Y on it"--it might
> be a controller with PSX labels, which has symbols rather than letters.


Absolutely. However, I believe that it's impossible to tell the button position on any platform. E.g., see the controllers for PS3 or XBOX 360 in game stores. The button position can be changed by the controller vender. Actually, controller pad and joy stick like arcade video game machine have different layout. However, most game has button configuration and they handle each buttons.

So, web application as game platform needs to implement button configuration on each application since there are a lot of different environment. But then, the platform information and the key name should help the developers to decide default button configuration. So, I think that .key for games is useful if the developer checks the platform name. Therefore, I think it does make sense to tell "button Y pressed" with key event to web applications for their developers.

> (For that matter, why are gamepad controllers being mapped like keys?  They
> should be exposed with a joystick API, not generate key events.)


Is there such draft? And you think that any web platforms must not generate key events for all buttons on game pad or joy stick?

##### Comment 5 Olli Pettay 2013-03-05 08:55:17 UTC
(In reply to comment #4)
> Is there such draft? And you think that any web platforms must not generate
> key events for all buttons on game pad or joy stick?


https://bugzilla.mozilla.org/show_bug.cgi?id=604039
https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html

##### Comment 6 Masayuki Nakano 2013-03-05 11:48:57 UTC
Thank you for the information.

Do you think that UA shouldn't dispatch DOM key events for joy stick's button? If yes, why the keyboard location has "joystick" value?

##### Comment 7 Olli Pettay 2013-03-05 12:00:03 UTC
(In reply to comment #6)
> Do you think that UA shouldn't dispatch DOM key events for joy stick's
> button?

Not sure. At least it isn't super important if Gamepad API is supported.


> If yes, why the keyboard location has "joystick" value?

Well, D3E is older than Gamepad API.

##### Comment 8 Glenn Maynard 2013-03-07 01:47:20 UTC
(In reply to comment #4)
> > Being told "the user pressed GameButtonY" doesn't tell the web developer
> > anything.  It doesn't even mean "pushed a button with a Y on it"--it might
> > be a controller with PSX labels, which has symbols rather than letters.
> 
> Absolutely. However, I believe that it's impossible to tell the button
> position on any platform. E.g., see the controllers for PS3 or XBOX 360 in
> game stores. The button position can be changed by the controller vender.


Not at all.  It's not hard to tell that you're on a 360 controller, and to map things appropriately.  Any competent joystick API will handle this, giving implementation direction for common controllers, so games using the API can have sensible default mappings for various production controllers.  But, this isn't a gamepad API trying to solve these problems.

> So, web application as game platform needs to implement button configuration
> on each application since there are a lot of different environment. But
> then, the platform information and the key name should help the developers
> to decide default button configuration. So, I think that .key for games is
> useful if the developer checks the platform name. Therefore, I think it does
> make sense to tell "button Y pressed" with key event to web applications for
> their developers.


Woah, wait.  Hold up.  You're designing a web API with the expectation of people using UA sniffing to figure out what the symbols mean?

##### Comment 9 Masayuki Nakano 2013-03-07 05:19:21 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > > Being told "the user pressed GameButtonY" doesn't tell the web developer
> > > anything.  It doesn't even mean "pushed a button with a Y on it"--it might
> > > be a controller with PSX labels, which has symbols rather than letters.
> > 
> > Absolutely. However, I believe that it's impossible to tell the button
> > position on any platform. E.g., see the controllers for PS3 or XBOX 360 in
> > game stores. The button position can be changed by the controller vender.
> 
> Not at all.  It's not hard to tell that you're on a 360 controller, and to
> map things appropriately.  Any competent joystick API will handle this,
> giving implementation direction for common controllers, so games using the
> API can have sensible default mappings for various production controllers. 
> But, this isn't a gamepad API trying to solve these problems.


I meant that even if the button is labeled "L1", the button isn't like a trigger key if the controller is a joystick. So, telling which button is being pressed to web developer with any API set never tells actual meaning.

> > So, web application as game platform needs to implement button configuration
> > on each application since there are a lot of different environment. But
> > then, the platform information and the key name should help the developers
> > to decide default button configuration. So, I think that .key for games is
> > useful if the developer checks the platform name. Therefore, I think it does
> > make sense to tell "button Y pressed" with key event to web applications for
> > their developers.
> 
> Woah, wait.  Hold up.  You're designing a web API with the expectation of
> people using UA sniffing to figure out what the symbols mean?


I think that the important thing for web developers is, they can distinguish the pressed button from other buttons. I think the description of the last part (* of GameButton*) does NOT tell useful information to web developers.

Like Android, if there is no reference hardware design on the platform, probably web game developers need to check the UA or hardware vender for providing better default button settings for their users.

On the other hand, if there is a reference hardware design like XBOX or PS, web game developers can provide better default button settings with the platform information.

But if KeyboardEvent.key doesn't provide the button names, they cannot distinguish the buttons and if it's not defined in D3E spec, UA implementers might define different button names for same buttons on Android. Therefore, I filed this bug for the compatibility between web browsers on Android.


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/13

Received on Tuesday, 6 October 2015 22:43:26 UTC