From e0c828579cd9acff8702728869b8e5b8a2c6beae Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Fri, 3 Sep 2021 16:29:57 +0200 Subject: [PATCH] Make 6618e99 follow existing ObjC code style Also allow uiIdle() to run for X11 --- .../EmbedExternalUI/EmbedExternalExampleUI.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp b/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp index 302b7a08..e4715c73 100644 --- a/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp +++ b/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp @@ -93,12 +93,13 @@ public: [NSApp activateIgnoringOtherApps:YES]; } - fView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, getWidth(), getHeight())]; + fView = [NSView new]; DISTRHO_SAFE_ASSERT_RETURN(fView != nullptr,); - fView.autoresizesSubviews = YES; - fView.wantsLayer = YES; - fView.layer.backgroundColor = NSColor.blueColor.CGColor; + [fView setFrame:NSMakeRect(0, 0, getWidth(), getHeight())]; + [fView setAutoresizesSubviews:YES]; + [fView setWantsLayer:YES]; + [[fView layer] setBackgroundColor:[[NSColor blueColor] CGColor]]; if (isEmbed()) { @@ -269,9 +270,9 @@ protected: UI::sizeChanged(width, height); #if defined(DISTRHO_OS_MAC) - NSRect rect = fView.frame; + NSRect rect = [fView frame]; rect.size = CGSizeMake((CGFloat)width, (CGFloat)height); - fView.frame = rect; + [fView setFrame:rect]; #elif defined(DISTRHO_OS_WINDOWS) #else if (fWindow != 0) @@ -342,12 +343,12 @@ protected: void uiIdle() override { + // d_stdout("uiIdle"); +#if defined(DISTRHO_OS_MAC) if (isEmbed()) { return; } - // d_stdout("uiIdle"); -#if defined(DISTRHO_OS_MAC) NSAutoreleasePool* const pool = [[NSAutoreleasePool alloc] init]; NSDate* const date = [NSDate distantPast];