Synchronize joystick events between all ports

Generate wxJoystickEvent with the same fields under all platforms by
making the Linux and macOS versions follow MSW convention of using
"1 << N" for the changed button.

Add GetButtonOrdinal() accessor which can be used to retrieve just N.

Closes #18233.
This commit is contained in:
Mick Phillips
2018-11-05 16:37:53 +00:00
committed by Vadim Zeitlin
parent cf980cf5e3
commit 291a880d0c
8 changed files with 57 additions and 25 deletions

View File

@@ -1741,10 +1741,24 @@ public:
/**
Returns the identifier of the button changing state.
This is a @c wxJOY_BUTTONn identifier, where @c n is one of 1, 2, 3, 4.
The return value is @code 1 << n @endcode where @c n is the index of the
button changing state.
Note that for @c n equal to 1, 2, 3 or 4 there are predefined @c wxJOY_BUTTONn
constants which can be used for more clarity, however these constants are not
defined for the buttons beyond the first four.
and whose values were 1 << n. To support more than four buttons, the return value
is now defined as 1 << n.
*/
int GetButtonChange() const;
/**
Returns the 0-indexed ordinal of the button changing state.
@since 3.1.2.
*/
int GetButtonOrdinal() const;
/**
Returns the down state of the buttons.