tentative merge vst3/macos timer
This commit is contained in:
parent
cfc1c69b4f
commit
99fe4d7044
@ -866,6 +866,7 @@ typedef struct controller {
|
|||||||
} controller;
|
} controller;
|
||||||
|
|
||||||
static Steinberg_Vst_IEditControllerVtbl controllerVtblIEditController;
|
static Steinberg_Vst_IEditControllerVtbl controllerVtblIEditController;
|
||||||
|
|
||||||
#ifdef DATA_UI
|
#ifdef DATA_UI
|
||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
# include <X11/Xlib.h>
|
# include <X11/Xlib.h>
|
||||||
@ -932,6 +933,8 @@ static Steinberg_ITimerHandlerVtbl timerHandlerVtblITimerHandler = {
|
|||||||
/* ITimerHandler */
|
/* ITimerHandler */
|
||||||
/* .onTimer = */ timerHandlerOnTimer
|
/* .onTimer = */ timerHandlerOnTimer
|
||||||
};
|
};
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
# include <CoreFoundation/CoreFoundation.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
typedef struct plugView {
|
typedef struct plugView {
|
||||||
@ -944,6 +947,8 @@ typedef struct plugView {
|
|||||||
Steinberg_IRunLoop * runLoop;
|
Steinberg_IRunLoop * runLoop;
|
||||||
timerHandler timer;
|
timerHandler timer;
|
||||||
Display * display;
|
Display * display;
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
CFRunLoopTimerRef timer;
|
||||||
# endif
|
# endif
|
||||||
} plugView;
|
} plugView;
|
||||||
|
|
||||||
@ -1037,6 +1042,12 @@ static void plugViewSetParameterCb(void *handle, size_t index, float value) {
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef __APPLE__
|
||||||
|
static void plugViewTimerCb(CFRunLoopTimerRef timer, void *info) {
|
||||||
|
plugin_ui_idle(((plugView *)info)->ui);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Steinberg_FIDString type) {
|
static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Steinberg_FIDString type) {
|
||||||
// GUI needs to be created here, see https://forums.steinberg.net/t/vst-and-hidpi/201916/3
|
// GUI needs to be created here, see https://forums.steinberg.net/t/vst-and-hidpi/201916/3
|
||||||
TRACE("plugView attached %p\n", thisInterface);
|
TRACE("plugView attached %p\n", thisInterface);
|
||||||
@ -1071,6 +1082,16 @@ static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Ste
|
|||||||
v->ui = NULL;
|
v->ui = NULL;
|
||||||
return Steinberg_kResultFalse;
|
return Steinberg_kResultFalse;
|
||||||
}
|
}
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
CFRunLoopTimerContext ctx = {
|
||||||
|
/* .version = */ 0,
|
||||||
|
/* .info = */ v,
|
||||||
|
/* .retain = */ NULL,
|
||||||
|
/* .release = */ NULL,
|
||||||
|
/* .copyDescription = */ NULL
|
||||||
|
};
|
||||||
|
v->timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 20.0 / 1000.0, 0, 0, plugViewTimerCb, &ctx);
|
||||||
|
CFRunLoopAddTimer(CFRunLoopGetCurrent(), v->timer, kCFRunLoopCommonModes);
|
||||||
# endif
|
# endif
|
||||||
# if DATA_PRODUCT_PARAMETERS_N > 0
|
# if DATA_PRODUCT_PARAMETERS_N > 0
|
||||||
plugViewUpdateAllParameters(v);
|
plugViewUpdateAllParameters(v);
|
||||||
@ -1084,6 +1105,9 @@ static Steinberg_tresult plugViewRemoved(void* thisInterface) {
|
|||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
v->runLoop->lpVtbl->unregisterTimer(v->runLoop, (struct Steinberg_ITimerHandler *)&v->timer);
|
v->runLoop->lpVtbl->unregisterTimer(v->runLoop, (struct Steinberg_ITimerHandler *)&v->timer);
|
||||||
XCloseDisplay(v->display);
|
XCloseDisplay(v->display);
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
CFRunLoopTimerInvalidate(v->timer);
|
||||||
|
CFRelease(v->timer);
|
||||||
# endif
|
# endif
|
||||||
plugin_ui_free(v->ui);
|
plugin_ui_free(v->ui);
|
||||||
v->ui = NULL;
|
v->ui = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user