@@ -14,7 +14,7 @@ use vst3::Steinberg::{
1414 IPlugViewContentScaleSupportTrait , IPlugViewContentScaleSupport_ :: ScaleFactor , IPlugViewTrait ,
1515 ViewRect ,
1616} ;
17- use vst3:: { Class , ComPtr , ComRef } ;
17+ use vst3:: { Class , ComPtr , ComRef , ComWrapper } ;
1818
1919use super :: inner:: { Task , WrapperInner } ;
2020use crate :: plugin:: vst3:: Vst3Plugin ;
@@ -125,9 +125,9 @@ impl<P: Vst3Plugin> WrapperView<P> {
125125 ///
126126 /// May cause memory corruption in Linux REAPER when called from outside of the `IRunLoop`.
127127 #[ must_use]
128- pub unsafe fn request_resize ( & self ) -> bool {
128+ pub unsafe fn request_resize ( this : & ComWrapper < Self > ) -> bool {
129129 // Don't do anything if the editor is not open, because that would be strange
130- if self
130+ if this
131131 . editor_handle
132132 . try_read ( )
133133 . map ( |e| e. is_none ( ) )
@@ -136,31 +136,26 @@ impl<P: Vst3Plugin> WrapperView<P> {
136136 return false ;
137137 }
138138
139- match & * self . plug_frame . read ( ) {
139+ match & * this . plug_frame . read ( ) {
140140 Some ( plug_frame) => {
141- let ( unscaled_width, unscaled_height) = self . editor . lock ( ) . size ( ) ;
142- let scaling_factor = self . scaling_factor . load ( Ordering :: Relaxed ) ;
141+ let ( unscaled_width, unscaled_height) = this . editor . lock ( ) . size ( ) ;
142+ let scaling_factor = this . scaling_factor . load ( Ordering :: Relaxed ) ;
143143 let mut size = ViewRect {
144144 left : 0 ,
145145 top : 0 ,
146146 right : ( unscaled_width as f32 * scaling_factor) . round ( ) as i32 ,
147147 bottom : ( unscaled_height as f32 * scaling_factor) . round ( ) as i32 ,
148148 } ;
149149
150- // // The argument types are a bit wonky here because you can't construct a
151- // // `SharedVstPtr`. This _should_ work however.
152- // let plug_view: SharedVstPtr<dyn IPlugView> =
153- // mem::transmute(&self.__iplugviewvptr as *const *const _);
154- // let result = plug_frame.resize_view(plug_view, &mut size);
150+ let plug_view = this. to_com_ptr :: < IPlugView > ( ) . unwrap ( ) ;
151+ let result = plug_frame. resizeView ( plug_view. into_raw ( ) , & mut size) ;
155152
156- // debug_assert_eq!(
157- // result, kResultOk,
158- // "The host denied the resize, we currently don't handle this for VST3 plugins"
159- // );
153+ debug_assert_eq ! (
154+ result, kResultOk,
155+ "The host denied the resize, we currently don't handle this for VST3 plugins"
156+ ) ;
160157
161- // result == kResultOk
162-
163- true
158+ result == kResultOk
164159 }
165160 None => false ,
166161 }
0 commit comments