mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
macOS 11: Fix function pointer conversions
This commit is contained in:
parent
2022407f97
commit
f9f5caa5cc
9 changed files with 17 additions and 19 deletions
|
|
@ -1642,7 +1642,7 @@ public:
|
|||
if (activeUIs.contains (self))
|
||||
shutdown (self);
|
||||
|
||||
sendSuperclassMessage (self, @selector (dealloc));
|
||||
sendSuperclassMessage<void> (self, @selector (dealloc));
|
||||
}
|
||||
|
||||
static void applicationWillTerminate (id self, SEL, NSNotification*)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ struct AudioTrackProducerClass : public ObjCClass <NSObject>
|
|||
private:
|
||||
static id initWithAudioSourceHolder (id self, SEL, AudioSourceHolder* source)
|
||||
{
|
||||
self = sendSuperclassMessage (self, @selector (init));
|
||||
self = sendSuperclassMessage<id> (self, @selector (init));
|
||||
object_setInstanceVariable (self, "source", source);
|
||||
return self;
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ private:
|
|||
static void dealloc (id self, SEL)
|
||||
{
|
||||
delete getSource (self);
|
||||
sendSuperclassMessage (self, @selector (dealloc));
|
||||
sendSuperclassMessage<void> (self, @selector (dealloc));
|
||||
}
|
||||
|
||||
static void cleanupTrackAfterBurn (id, SEL, DRTrack*) {}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ private:
|
|||
|
||||
static id initWithCallbacks (id self, SEL, Callbacks* cbs)
|
||||
{
|
||||
self = sendSuperclassMessage (self, @selector (init));
|
||||
self = sendSuperclassMessage<id> (self, @selector (init));
|
||||
|
||||
object_setInstanceVariable (self, "callbacks", cbs);
|
||||
object_setInstanceVariable (self, "controller", [CABTLEMIDIWindowController new]);
|
||||
|
|
@ -81,7 +81,7 @@ private:
|
|||
{
|
||||
[getController (self) release];
|
||||
|
||||
sendSuperclassMessage (self, @selector (dealloc));
|
||||
sendSuperclassMessage<void> (self, @selector (dealloc));
|
||||
}
|
||||
|
||||
static void show (id self, SEL, Rectangle<int>* bounds)
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ NSRect makeNSRect (const RectangleType& r) noexcept
|
|||
#endif
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
|
||||
// This is necessary as on iOS builds, some arguments may be passed on registers
|
||||
// This is necessary as on iOS/ARM builds, some arguments may be passed on registers
|
||||
// depending on the argument type. The re-cast objc_msgSendSuper to a function
|
||||
// take the same arguments as the target method.
|
||||
template <typename ReturnValue, typename... Params>
|
||||
|
|
@ -205,9 +205,6 @@ ReturnValue ObjCMsgSendSuper (struct objc_super* s, SEL sel, Params... params)
|
|||
return fn (s, sel, params...);
|
||||
}
|
||||
|
||||
// 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, ...);
|
||||
inline MsgSendSuperFn getMsgSendSuperFn() noexcept { return (MsgSendSuperFn) (void*) objc_msgSendSuper; }
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -282,10 +279,11 @@ struct ObjCClass
|
|||
}
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
static id sendSuperclassMessage (id self, SEL selector)
|
||||
template <typename Result>
|
||||
static Result sendSuperclassMessage (id self, SEL selector)
|
||||
{
|
||||
objc_super s = { self, [SuperclassType class] };
|
||||
return getMsgSendSuperFn() (&s, selector);
|
||||
return ObjCMsgSendSuper<Result> (&s, selector);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1773,7 +1773,7 @@ private:
|
|||
if (! (owner->textWasInserted || owner->redirectKeyDown (ev)))
|
||||
{
|
||||
objc_super s = { self, [NSView class] };
|
||||
getMsgSendSuperFn() (&s, @selector (keyDown:), ev);
|
||||
ObjCMsgSendSuper<void> (&s, @selector (keyDown:), ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1785,7 +1785,7 @@ private:
|
|||
if (owner == nullptr || ! owner->redirectKeyUp (ev))
|
||||
{
|
||||
objc_super s = { self, [NSView class] };
|
||||
getMsgSendSuperFn() (&s, @selector (keyUp:), ev);
|
||||
ObjCMsgSendSuper<void> (&s, @selector (keyDown:), ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2036,7 +2036,7 @@ private:
|
|||
|
||||
static void becomeKeyWindow (id self, SEL)
|
||||
{
|
||||
sendSuperclassMessage (self, @selector (becomeKeyWindow));
|
||||
sendSuperclassMessage<void> (self, @selector (becomeKeyWindow));
|
||||
|
||||
if (auto* owner = getOwner (self))
|
||||
{
|
||||
|
|
@ -2107,7 +2107,7 @@ private:
|
|||
{
|
||||
owner->isZooming = true;
|
||||
objc_super s = { self, [NSWindow class] };
|
||||
getMsgSendSuperFn() (&s, @selector (zoom:), sender);
|
||||
ObjCMsgSendSuper<void> (&s, @selector (zoom:), sender);
|
||||
owner->isZooming = false;
|
||||
|
||||
owner->redirectMovedOrResized();
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ private:
|
|||
delete getIvar<std::function<void()>*> (self, "callback");
|
||||
delete getIvar<NSDragOperation*> (self, "operation");
|
||||
|
||||
sendSuperclassMessage (self, @selector (dealloc));
|
||||
sendSuperclassMessage<void> (self, @selector (dealloc));
|
||||
}
|
||||
|
||||
static void provideDataForType (id self, SEL, NSPasteboard* sender, NSPasteboardItem*, NSString* type)
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ private:
|
|||
}
|
||||
|
||||
objc_super s = { self, [WebView class] };
|
||||
return ObjCMsgSendSuper<BOOL, NSEvent*> (&s, selector, event);
|
||||
return ObjCMsgSendSuper<BOOL> (&s, selector, event);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1271,7 +1271,7 @@ struct CameraDevice::ViewerComponent : public UIViewComponent
|
|||
private:
|
||||
static void layoutSubviews (id self, SEL)
|
||||
{
|
||||
sendSuperclassMessage (self, @selector (layoutSubviews));
|
||||
sendSuperclassMessage<void> (self, @selector (layoutSubviews));
|
||||
|
||||
UIView* asUIView = (UIView*) self;
|
||||
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ private:
|
|||
private:
|
||||
static void layoutSubviews (id self, SEL)
|
||||
{
|
||||
sendSuperclassMessage (self, @selector (layoutSubviews));
|
||||
sendSuperclassMessage<void> (self, @selector (layoutSubviews));
|
||||
|
||||
UIView* asUIView = (UIView*) self;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue