DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 87986a6f343a937dea4f3db3a591beacea8251e2
parent 1c19c75b8f2b4a83741c4c92e486c1fde873050e
Author: falkTX <falktx@falktx.com>
Date:   Tue, 12 Oct 2021 14:21:04 +0100

Fix Window resize using old size in some situations

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/src/pugl.cpp | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp @@ -354,17 +354,18 @@ PuglStatus puglSetWindowSize(PuglView* const view, const uint width, const uint { view->defaultWidth = width; view->defaultHeight = height; + view->frame.width = width; + view->frame.height = height; -#if defined(DISTRHO_OS_HAIKU) || defined(DISTRHO_OS_MAC) - // replace the 2 views setFrame with setFrameSize - const PuglRect frame = { view->frame.x, view->frame.y, (double)width, (double)height }; +#if defined(DISTRHO_OS_HAIKU) +#elif defined(DISTRHO_OS_MAC) + // replace setFrame with setFrameSize PuglInternals* const impl = view->impl; - // Update view frame to exactly the requested frame in Pugl coordinates - view->frame = frame; - + const PuglRect frame = view->frame; const NSRect framePx = rectToNsRect(frame); const NSRect framePt = nsRectToPoints(view, framePx); + if (impl->window) { // Resize window to fit new content rect @@ -418,8 +419,6 @@ PuglStatus puglSetWindowSize(PuglView* const view, const uint width, const uint } #endif - view->frame.width = width; - view->frame.height = height; return PUGL_SUCCESS; }