Skip to content

Commit

Permalink
[fix] building with anything older than Xcode15
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Jan 15, 2024
1 parent 0cb9df5 commit c98c384
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion vstgui/contrib/externalview_nsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,26 @@ struct ExternalNSViewBase : ViewAdapter

ExternalNSViewBase (ViewType* inView) : view (inView)
{
container.clipsToBounds = YES;
if (@available (macOS 14, *))
{
#ifdef MAC_OS_VERSION_14_0
// only available when building with the mac os sdk 14.0
container.clipsToBounds = YES;
#else
// but necessary to set to YES on macOS 14 even when not building with Xcode 15
if ([container respondsToSelector:@selector (setClipsToBounds:)])
{
BOOL clipsToBounds = YES;
auto* signature = [[container class]
instanceMethodSignatureForSelector:@selector (setClipsToBounds:)];
auto* invocation = [NSInvocation invocationWithMethodSignature:signature];
invocation.target = container;
invocation.selector = @selector (setClipsToBounds:);
[invocation setArgument:&clipsToBounds atIndex:2];
[invocation invoke];
}
#endif
}
[container addSubview:view];
}

Expand Down

0 comments on commit c98c384

Please sign in to comment.