Skip to content

Commit

Permalink
Fix resize recursion when triggered via host
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jun 20, 2022
1 parent da61999 commit 7860e6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CardinalUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -610,7 +611,7 @@ class CardinalUI : public CardinalBaseUI,
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];
Expand Down
5 changes: 5 additions & 0 deletions src/override/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7860e6e

Please sign in to comment.