Skip to content

Commit

Permalink
fix crash on macOS 10.11 or earlier and increase patchlevel version
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Sep 15, 2021
1 parent 6c48e17 commit 0de3d83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions vstgui/lib/platform/mac/cocoa/nsviewframe.mm
Expand Up @@ -284,9 +284,12 @@ static void VSTGUI_NSView_drawRect (id self, SEL _cmd, NSRect rect)
//------------------------------------------------------------------------
static void VSTGUI_NSView_viewWillDraw (id self, SEL _cmd)
{
if (auto layer = [self layer])
if (@available (macOS 10.12, *))
{
layer.contentsFormat = kCAContentsFormatRGBA8Uint;
if (auto layer = [self layer])
{
layer.contentsFormat = kCAContentsFormatRGBA8Uint;
}
}
__OBJC_SUPER (self)
SuperViewWillRedraw (SUPER, _cmd);
Expand Down Expand Up @@ -834,15 +837,14 @@ static id VSTGUI_NSView_makeTouchbar (id self)
auto processInfo = [NSProcessInfo processInfo];
if ([processInfo respondsToSelector:@selector(operatingSystemVersion)])
{
auto systemVersion = processInfo.operatingSystemVersion;
// on Mac OS X 10.11 we activate layer drawing as this fixes a few issues like that only a
// few parts of a window are updated permanently when scrolling or manipulating a control
// while other parts are only updated when the malipulation ended, or CNinePartTiledBitmap
// are drawn incorrectly when scaled.
if (systemVersion.majorVersion > 10 || (systemVersion.majorVersion >= 10 && systemVersion.minorVersion > 10))
if (@available (macOS 10.11, *))
{
[nsView setWantsLayer:YES];
if (systemVersion.majorVersion > 10 || (systemVersion.majorVersion >= 10 && systemVersion.minorVersion >= 13))
if (@available (macOS 10.13, *))
{
nsView.layer.contentsFormat = kCAContentsFormatRGBA8Uint;
// asynchronous layer drawing or drawing only dirty rectangles are exclusive as
Expand Down
2 changes: 1 addition & 1 deletion vstgui/lib/vstguibase.h
Expand Up @@ -13,7 +13,7 @@
//-----------------------------------------------------------------------------
#define VSTGUI_VERSION_MAJOR 4
#define VSTGUI_VERSION_MINOR 10
#define VSTGUI_VERSION_PATCHLEVEL 1
#define VSTGUI_VERSION_PATCHLEVEL 2

//-----------------------------------------------------------------------------
// Platform definitions
Expand Down

0 comments on commit 0de3d83

Please sign in to comment.