From b6c75ef42af61350d7e273172b43ea5a889e074f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 27 Apr 2021 23:50:59 +0200 Subject: [PATCH] Fix Mac Plugin re/sizing Some plugin UIs, particularly those that cannot be resized unset `autoresizesSubviews`. Since the plugin-view is re-parented, the host has to directly set the view's size. However some plugins have multiple child views, apparently for off-screen pixmaps (e.g. UAD plugins). Those additional should not be resized (or re-stacked). e.g. Reason-Rack view 0x7fe27e44e570 @ 0, 33 834 x 804 view 0x7fe288aa3770 @ 278, 268 278 x 268 UAD Tube-tech view 0x7fe270a9cbf0 @ 0, 33 1160 x 374 view 0x7fe28883d030 @ 0, 0 1160 x 374 view 0x7fe2888546e0 @ 0, 0 1160 x 24 see also aef366c1568d1759bd82873d9bfdac33e47c11b1 https://discourse.ardour.org/t/uad-plugin-will-not-load-shows-as-expired-when-its-not/105756/5?u=x42 --- gtk2_ardour/au_pluginui.mm | 2 ++ gtk2_ardour/mac_vst_plugin_ui.mm | 1 + gtk2_ardour/vst3_nsview_plugin_ui.mm | 1 + 3 files changed, 4 insertions(+) diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 0434511f14..09f3eaf25b 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -867,6 +867,7 @@ AUPluginUI::cocoa_view_resized () 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)]; + break; /* only resize first subview */ } /* also be sure to redraw the topbox because this can @@ -1092,6 +1093,7 @@ AUPluginUI::parent_cocoa_window () for (unsigned long i = 0; i < [subviews count]; ++i) { NSView* subview = [subviews objectAtIndex:i]; [subview setFrame:NSMakeRect (0, 0, req_width, req_height)]; + break; /* only resize first subview */ } last_au_frame = [au_view frame]; diff --git a/gtk2_ardour/mac_vst_plugin_ui.mm b/gtk2_ardour/mac_vst_plugin_ui.mm index 082bfa99fc..4666264b97 100644 --- a/gtk2_ardour/mac_vst_plugin_ui.mm +++ b/gtk2_ardour/mac_vst_plugin_ui.mm @@ -222,6 +222,7 @@ MacVSTPluginUI::lower_box_size_allocate (Gtk::Allocation& allocation) for (unsigned long i = 0; i < [subviews count]; ++i) { NSView* subview = [subviews objectAtIndex:i]; [subview setFrame:NSMakeRect (0, 0, allocation.get_width (), allocation.get_height ())]; + break; /* only resize first subview */ } } diff --git a/gtk2_ardour/vst3_nsview_plugin_ui.mm b/gtk2_ardour/vst3_nsview_plugin_ui.mm index b5b665ba09..50e32de071 100644 --- a/gtk2_ardour/vst3_nsview_plugin_ui.mm +++ b/gtk2_ardour/vst3_nsview_plugin_ui.mm @@ -153,6 +153,7 @@ VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation) for (unsigned long i = 0; i < [subviews count]; ++i) { NSView* subview = [subviews objectAtIndex:i]; [subview setFrame:NSMakeRect (0, 0, allocation.get_width (), allocation.get_height ())]; + break; /* only resize first subview */ } }