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).
This commit is contained in:
Robin Gareus 2020-11-19 23:08:32 +01:00
parent abfceea98c
commit aef366c156
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 13 additions and 0 deletions

View File

@ -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 ];