|
|
|
@@ -302,9 +302,30 @@ PuglStatus puglSetWindowSize(PuglView* const view, const uint width, const uint |
|
|
|
view->defaultHeight = height; |
|
|
|
|
|
|
|
#if defined(DISTRHO_OS_HAIKU) || defined(DISTRHO_OS_MAC) |
|
|
|
// keep upstream behaviour |
|
|
|
// replace the 2 views setFrame with setFrameSize |
|
|
|
const PuglRect frame = { view->frame.x, view->frame.y, (double)width, (double)height }; |
|
|
|
return puglSetFrame(view, frame); |
|
|
|
PuglInternals* const impl = view->impl; |
|
|
|
|
|
|
|
// Update view frame to exactly the requested frame in Pugl coordinates |
|
|
|
view->frame = frame; |
|
|
|
|
|
|
|
const NSRect framePx = rectToNsRect(frame); |
|
|
|
const NSRect framePt = nsRectToPoints(view, framePx); |
|
|
|
if (impl->window) |
|
|
|
{ |
|
|
|
// Resize window to fit new content rect |
|
|
|
const NSRect screenPt = rectToScreen(viewScreen(view), framePt); |
|
|
|
const NSRect winFrame = [impl->window frameRectForContentRect:screenPt]; |
|
|
|
|
|
|
|
[impl->window setFrame:winFrame display:NO]; |
|
|
|
} |
|
|
|
|
|
|
|
// Resize views |
|
|
|
const NSSize sizePx = NSMakeSize(frame.width, frame.height); |
|
|
|
const NSSize sizePt = [impl->drawView convertSizeFromBacking:sizePx]; |
|
|
|
|
|
|
|
[impl->wrapperView setFrameSize:(impl->window ? sizePt : framePt.size)]; |
|
|
|
[impl->drawView setFrameSize:sizePt]; |
|
|
|
#elif defined(DISTRHO_OS_WINDOWS) |
|
|
|
// matches upstream pugl, except we add SWP_NOMOVE flag |
|
|
|
if (view->impl->hwnd) |
|
|
|
|