From d8b5016960c12b851db18211e1e285e7610c6630 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 31 May 2024 10:05:44 +0200 Subject: [PATCH] vst3/macos resize --- templates/vst3/src/vst3.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index 75eb533..23315ca 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with Tibia. If not, see . * - * File author: Stefano D'Angelo + * File author: Stefano D'Angelo, Paolo Marrone */ #include @@ -935,6 +935,9 @@ static Steinberg_ITimerHandlerVtbl timerHandlerVtblITimerHandler = { }; # elif defined(__APPLE__) # include +# include +# include +# include # endif typedef struct plugView { @@ -1044,6 +1047,8 @@ static void plugViewSetParameterCb(void *handle, size_t index, float value) { # ifdef __APPLE__ static void plugViewTimerCb(CFRunLoopTimerRef timer, void *info) { + (void)timer; + plugin_ui_idle(((plugView *)info)->ui); } # endif @@ -1179,6 +1184,10 @@ static Steinberg_tresult plugViewOnSize(void* thisInterface, struct Steinberg_Vi # ifdef __linux__ TRACE(" window %u\n", (Window)(*((char **)v->ui))); XResizeWindow(v->display, (Window)(*((char **)v->ui)), newSize->right - newSize->left, newSize->bottom - newSize->top); +# elif defined(__APPLE__) + CGSize size = { newSize->right - newSize->left, newSize->bottom - newSize->top }; + void (*f)(id, SEL, CGSize) = (void (*)(id, SEL, CGSize))objc_msgSend; + f((id)(*((char**)v->ui)), sel_getUid("setFrameSize:"), size); # endif return Steinberg_kResultTrue; }