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:
committed by
Vadim Zeitlin
parent
cf980cf5e3
commit
291a880d0c
@@ -15,6 +15,7 @@
|
||||
#include "wx/cpp.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/clntdata.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#if wxUSE_GUI
|
||||
#include "wx/gdicmn.h"
|
||||
@@ -2760,6 +2761,7 @@ public:
|
||||
int GetZPosition() const { return m_zPosition; }
|
||||
int GetButtonState() const { return m_buttonState; }
|
||||
int GetButtonChange() const { return m_buttonChange; }
|
||||
int GetButtonOrdinal() const { return wxCTZ(m_buttonChange); }
|
||||
int GetJoystick() const { return m_joyStick; }
|
||||
|
||||
void SetJoystick(int stick) { m_joyStick = stick; }
|
||||
|
@@ -181,4 +181,14 @@ inline double wxRadToDeg(double rad) { return (rad * 180.0) / M_PI; }
|
||||
/* Compute the greatest common divisor of two positive integers */
|
||||
WXDLLIMPEXP_BASE unsigned int wxGCD(unsigned int u, unsigned int v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* Count trailing zeros
|
||||
|
||||
Returns the number of trailing zeros in unsigned input x.
|
||||
|
||||
@since 3.1.2
|
||||
*/
|
||||
WXDLLIMPEXP_BASE unsigned int wxCTZ(unsigned x);
|
||||
#endif
|
||||
|
||||
#endif /* _WX_MATH_H_ */
|
||||
|
Reference in New Issue
Block a user