diff --git a/modules/juce_opengl/native/juce_OpenGL_osx.h b/modules/juce_opengl/native/juce_OpenGL_osx.h index 8a2693e7f8..107590485c 100644 --- a/modules/juce_opengl/native/juce_OpenGL_osx.h +++ b/modules/juce_opengl/native/juce_OpenGL_osx.h @@ -29,6 +29,7 @@ public: void* contextToShare, bool shouldUseMultisampling, OpenGLVersion version) + : owner (component) { NSOpenGLPixelFormatAttribute attribs[64] = { 0 }; createAttribs (attribs, version, pixFormat, shouldUseMultisampling); @@ -188,7 +189,16 @@ public: lastSwapTime = now; } - void updateWindowPosition (Rectangle) {} + void updateWindowPosition (Rectangle) + { + if (auto* peer = owner.getTopLevelComponent()->getPeer()) + { + const auto newArea = peer->getAreaCoveredBy (owner); + + if (convertToRectInt ([view frame]) != newArea) + [view setFrame: makeNSRect (newArea)]; + } + } bool setSwapInterval (int numFramesPerSwapIn) { @@ -237,6 +247,7 @@ public: return NSOpenGLCPSwapInterval; } + Component& owner; NSOpenGLContext* renderContext = nil; NSOpenGLView* view = nil; ReferenceCountedObjectPtr viewAttachment;