MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / onResize

Function onResize

src/CardinalUI.cpp:1164–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162 }
1163
1164 void onResize(const ResizeEvent& ev) override
1165 {
1166 UI::onResize(ev);
1167
1168 if (context->window != nullptr)
1169 WindowSetInternalSize(context->window, rack::math::Vec(ev.size.getWidth(), ev.size.getHeight()));
1170
1171 const double scaleFactor = getScaleFactor();
1172 const int width = static_cast<int>(ev.size.getWidth() / scaleFactor + 0.5);
1173 const int height = static_cast<int>(ev.size.getHeight() / scaleFactor + 0.5);
1174
1175 char sizeString[64] = {};
1176 std::snprintf(sizeString, sizeof(sizeString) - 1, "%d:%d", width, height);
1177 setState("windowSize", sizeString);
1178
1179 if (rack::isStandalone())
1180 rack::settings::windowSize = rack::math::Vec(width, height);
1181 }
1182
1183 void uiFocus(const bool focus, CrossingMode) override
1184 {

Callers

nothing calls this directly

Calls 6

VecClass · 0.85
getWidthMethod · 0.80
getHeightMethod · 0.80
setStateFunction · 0.70
isStandaloneFunction · 0.70
WindowSetInternalSizeFunction · 0.50

Tested by

no test coverage detected