mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Workarounds to allow building with Xcode option "strict checking of objc_msgSend calls" enabled.
This commit is contained in:
parent
968a9eb392
commit
e1dcd96892
2 changed files with 14 additions and 7 deletions
|
|
@ -66,6 +66,13 @@ namespace
|
|||
static_cast <CGFloat> (r.getHeight()));
|
||||
}
|
||||
#endif
|
||||
|
||||
// These hacks are a workaround for newer Xcode builds which by default prevent calls to these objc functions..
|
||||
typedef id (*MsgSendSuperFn) (struct objc_super*, SEL, ...);
|
||||
static inline MsgSendSuperFn getMsgSendSuperFn() noexcept { return (MsgSendSuperFn) (void*) objc_msgSendSuper; }
|
||||
|
||||
typedef double (*MsgSendFPRetFn) (id, SEL op, ...);
|
||||
static inline MsgSendFPRetFn getMsgSendFPRetFn() noexcept { return (MsgSendFPRetFn) (void*) objc_msgSend_fpret; }
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -143,7 +150,7 @@ struct ObjCClass
|
|||
static id sendSuperclassMessage (id self, SEL selector)
|
||||
{
|
||||
objc_super s = { self, [SuperclassType class] };
|
||||
return objc_msgSendSuper (&s, selector);
|
||||
return getMsgSendSuperFn() (&s, selector);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
|
|
|
|||
|
|
@ -642,8 +642,8 @@ public:
|
|||
#endif
|
||||
if ([ev respondsToSelector: @selector (deviceDeltaX)])
|
||||
{
|
||||
wheel.deltaX = checkDeviceDeltaReturnValue ((float) objc_msgSend_fpret (ev, @selector (deviceDeltaX)));
|
||||
wheel.deltaY = checkDeviceDeltaReturnValue ((float) objc_msgSend_fpret (ev, @selector (deviceDeltaY)));
|
||||
wheel.deltaX = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaX)));
|
||||
wheel.deltaY = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaY)));
|
||||
}
|
||||
}
|
||||
@catch (...)
|
||||
|
|
@ -1491,7 +1491,7 @@ private:
|
|||
if ((! owner->textWasInserted) && (owner == nullptr || ! owner->redirectKeyDown (ev)))
|
||||
{
|
||||
objc_super s = { self, [NSView class] };
|
||||
objc_msgSendSuper (&s, @selector (keyDown:), ev);
|
||||
getMsgSendSuperFn() (&s, @selector (keyDown:), ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1503,7 +1503,7 @@ private:
|
|||
if (owner == nullptr || ! owner->redirectKeyUp (ev))
|
||||
{
|
||||
objc_super s = { self, [NSView class] };
|
||||
objc_msgSendSuper (&s, @selector (keyUp:), ev);
|
||||
getMsgSendSuperFn() (&s, @selector (keyUp:), ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1644,7 +1644,7 @@ private:
|
|||
return true;
|
||||
|
||||
objc_super s = { self, [NSView class] };
|
||||
return objc_msgSendSuper (&s, @selector (performKeyEquivalent:), ev) != nil;
|
||||
return getMsgSendSuperFn() (&s, @selector (performKeyEquivalent:), ev) != nil;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1805,7 +1805,7 @@ private:
|
|||
{
|
||||
owner->isZooming = true;
|
||||
objc_super s = { self, [NSWindow class] };
|
||||
objc_msgSendSuper (&s, @selector (zoom:), sender);
|
||||
getMsgSendSuperFn() (&s, @selector (zoom:), sender);
|
||||
owner->isZooming = false;
|
||||
|
||||
owner->redirectMovedOrResized();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue