diff --git a/src/Magnum/Platform/AndroidApplication.h b/src/Magnum/Platform/AndroidApplication.h index c4b7975e6..c650f517c 100644 --- a/src/Magnum/Platform/AndroidApplication.h +++ b/src/Magnum/Platform/AndroidApplication.h @@ -433,18 +433,46 @@ class AndroidApplication::MouseEvent: public InputEvent { /** * Left mouse button. Note that this button is not set if only * touch or stylus event occured. + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. */ + #if __ANDROID_API__ >= 14 Left = AMOTION_EVENT_BUTTON_PRIMARY, + #else + Left = 1 << 0, + #endif - /** Middle mouse button or second stylus button */ + /** + * Middle mouse button or second stylus button + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. + */ + #if __ANDROID_API__ >= 14 Middle = AMOTION_EVENT_BUTTON_TERTIARY, + #else + Middle = 1 << 1, + #endif - /** Right mouse button or first stylus button */ + /** + * Right mouse button or first stylus button + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. + */ + #if __ANDROID_API__ >= 14 Right = AMOTION_EVENT_BUTTON_SECONDARY + #else + Right = 1 << 2 + #endif }; /** @brief Button */ - Button button() { return Button(AMotionEvent_getButtonState(_event)); } + Button button() { + #if __ANDROID_API__ >= 14 + return Button(AMotionEvent_getButtonState(_event)); + #else + return Button::None; + #endif + } /** @brief Position */ Vector2i position() { @@ -474,14 +502,36 @@ class AndroidApplication::MouseMoveEvent: public InputEvent { /** * Left mouse button. Note that this button is not set if only * touch or stylus event occured. + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. */ + #if __ANDROID_API__ >= 14 Left = AMOTION_EVENT_BUTTON_PRIMARY, + #else + Left = 1 << 0, + #endif - /** Middle mouse button or second stylus button */ + /** + * Middle mouse button or second stylus button + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. + */ + #if __ANDROID_API__ >= 14 Middle = AMOTION_EVENT_BUTTON_TERTIARY, + #else + Middle = 1 << 1, + #endif - /** Right mouse button or first stylus button */ + /** + * Right mouse button or first stylus button + * @attention Available since Android 4.0 (API level 14), not + * detectable in earlier versions. + */ + #if __ANDROID_API__ >= 14 Right = AMOTION_EVENT_BUTTON_SECONDARY + #else + Right = 1 << 2 + #endif }; /** @@ -499,7 +549,11 @@ class AndroidApplication::MouseMoveEvent: public InputEvent { /** @brief Mouse buttons */ Buttons buttons() const { + #if __ANDROID_API__ >= 14 return Button(AMotionEvent_getButtonState(_event)); + #else + return {}; + #endif } private: