Fix resize recursion when triggered via host

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-06-20 11:34:07 +01:00
parent da61999de5
commit 7860e6e539
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
2 changed files with 7 additions and 1 deletions

View file

@ -46,6 +46,7 @@ namespace app {
namespace window {
void WindowSetPluginUI(Window* window, DISTRHO_NAMESPACE::UI* ui);
void WindowSetMods(Window* window, int mods);
void WindowSetInternalSize(rack::window::Window* window, math::Vec size);
}
}
@ -610,7 +611,7 @@ protected:
UI::onResize(ev);
if (context->window != nullptr)
context->window->setSize(rack::math::Vec(ev.size.getWidth(), ev.size.getHeight()));
WindowSetInternalSize(context->window, rack::math::Vec(ev.size.getWidth(), ev.size.getHeight()));
const double scaleFactor = getScaleFactor();
char sizeString[64];

View file

@ -355,6 +355,11 @@ void Window::setSize(math::Vec size) {
ui->setSize(internal->size.x, internal->size.y);
}
void WindowSetInternalSize(rack::window::Window* const window, math::Vec size) {
size = size.max(WINDOW_SIZE_MIN);
window->internal->size = size;
}
void Window::run() {
internal->frame = 0;