commit 25d7902818e34e95c084988f282e8c303d27bf38
parent 68edcd6926c634b881fe7d66edbdac22db0b0e77
Author: lucianoiam <oss@lucianoiam.com>
Date: Fri, 3 Sep 2021 17:50:22 +0200
Bugfix: EmbedExternalExampleUI resizing on Mac (#319)
* Bugfix: EmbedExternalExampleUI resizing on Mac
* Make 6618e99 follow existing ObjC code style
Also allow uiIdle() to run for X11
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp b/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp
@@ -96,11 +96,10 @@ public:
fView = [NSView new];
DISTRHO_SAFE_ASSERT_RETURN(fView != nullptr,);
- [fView initWithFrame:NSMakeRect(0, 0, getWidth(), getHeight())];
- [fView setAutoresizesSubviews:YES];
[fView setFrame:NSMakeRect(0, 0, getWidth(), getHeight())];
- [fView setHidden:NO];
- [fView setNeedsDisplay:YES];
+ [fView setAutoresizesSubviews:YES];
+ [fView setWantsLayer:YES];
+ [[fView layer] setBackgroundColor:[[NSColor blueColor] CGColor]];
if (isEmbed())
{
@@ -271,6 +270,9 @@ protected:
UI::sizeChanged(width, height);
#if defined(DISTRHO_OS_MAC)
+ NSRect rect = [fView frame];
+ rect.size = CGSizeMake((CGFloat)width, (CGFloat)height);
+ [fView setFrame:rect];
#elif defined(DISTRHO_OS_WINDOWS)
#else
if (fWindow != 0)
@@ -343,6 +345,10 @@ protected:
{
// d_stdout("uiIdle");
#if defined(DISTRHO_OS_MAC)
+ if (isEmbed()) {
+ return;
+ }
+
NSAutoreleasePool* const pool = [[NSAutoreleasePool alloc] init];
NSDate* const date = [NSDate distantPast];