Use __builtin_available() when available in wxMac builds

The advantage of using this compiler builtin instead of our own platform
checks is that the compiler will warn us (if -Wunguarded-availability is
turned on for APIs introduced before 10.13 or by default for later ones)
if a check is forgotten, which is not the case for the manual checks.

Update the code to use WX_IS_MACOS_AVAILABLE() macro, which expands to
__builtin_available() when supported, and also use API_AVAILABLE() where
it makes sense to avoid having too many checks.
This commit is contained in:
Vadim Zeitlin
2019-04-17 23:35:08 +02:00
parent a8262abc11
commit fe311b9cc5
16 changed files with 174 additions and 63 deletions

View File

@@ -148,13 +148,21 @@ public :
virtual bool SetupCursor(NSEvent* event);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
virtual void PanGestureEvent(NSPanGestureRecognizer *panGestureRecognizer);
virtual void ZoomGestureEvent(NSMagnificationGestureRecognizer *magnificationGestureRecognizer);
virtual void RotateGestureEvent(NSRotationGestureRecognizer *rotationGestureRecognizer);
virtual void LongPressEvent(NSPressGestureRecognizer *pressGestureRecognizer);
virtual void TouchesBegan(NSEvent *event);
virtual void TouchesMoved(NSEvent *event);
virtual void TouchesEnded(NSEvent *event);
#ifdef API_AVAILABLE
#define WX_AVAILABLE_10_10 API_AVAILABLE(macos(10.10))
#else
#define WX_AVAILABLE_10_10
#endif
WX_AVAILABLE_10_10 virtual void PanGestureEvent(NSPanGestureRecognizer *panGestureRecognizer);
WX_AVAILABLE_10_10 virtual void ZoomGestureEvent(NSMagnificationGestureRecognizer *magnificationGestureRecognizer);
WX_AVAILABLE_10_10 virtual void RotateGestureEvent(NSRotationGestureRecognizer *rotationGestureRecognizer);
WX_AVAILABLE_10_10 virtual void LongPressEvent(NSPressGestureRecognizer *pressGestureRecognizer);
WX_AVAILABLE_10_10 virtual void TouchesBegan(NSEvent *event);
WX_AVAILABLE_10_10 virtual void TouchesMoved(NSEvent *event);
WX_AVAILABLE_10_10 virtual void TouchesEnded(NSEvent *event);
#undef WX_AVAILABLE_10_10
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
#if !wxOSX_USE_NATIVE_FLIPPED