From aef366c1568d1759bd82873d9bfdac33e47c11b1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 19 Nov 2020 23:08:32 +0100 Subject: [PATCH] Fix AudioUnit window size for some non-resizable plugins Some fixed size AU, do unset `autoresizesSubviews` (Apple's default is enabled). This also results in the initial size, and position below Ardour's toolbar to be set incorrectly. This fixes e.g. Reason Rack Plug AU (and maybe others). --- gtk2_ardour/au_pluginui.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 840fc10464..ca0e4ad620 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -862,6 +862,13 @@ AUPluginUI::cocoa_view_resized () last_au_frame.origin.y != new_frame.origin.y) { new_frame.origin = last_au_frame.origin; [au_view setFrame:new_frame]; + + NSArray* subviews = [au_view subviews]; + for (unsigned long i = 0; i < [subviews count]; ++i) { + NSView* subview = [subviews objectAtIndex:i]; + [subview setFrame:NSMakeRect (0, 0, new_frame.size.width, new_frame.size.height)]; + } + /* also be sure to redraw the topbox because this can also go wrong. */ @@ -1081,6 +1088,12 @@ AUPluginUI::parent_cocoa_window () 0, 0, &xx, &yy); [au_view setFrame:NSMakeRect(xx, yy, req_width, req_height)]; + NSArray* subviews = [au_view subviews]; + for (unsigned long i = 0; i < [subviews count]; ++i) { + NSView* subview = [subviews objectAtIndex:i]; + [subview setFrame:NSMakeRect (0, 0, req_width, req_height)]; + } + last_au_frame = [au_view frame]; // watch for size changes of the view _notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:NULL andTopLevelParent:win ];