void setNativeHostWindowOrigin (Component* component, int newWidth, int newHeight)
NSView *childComp = (NSView*)component->getWindowHandle();
if (childComp != nil)
NSPoint frameOrigin = [childComp frame].origin;
frameOrigin.y += (newHeight - component->getHeight());
[childComp setFrameOrigin: frameOrigin];
extern void setNativeHostWindowOrigin (Component *editorComp, int newWidth, int newHeight);
void resizeHostWindow (int newWidth, int newHeight)
if (editorComp->getPeer() != nullptr)
setNativeHostWindowOrigin (editorComp, newWidth, newHeight);
CPB wrote:The parent NSView view is in the right place: it's the JUCE NSView's origin that gets incorrectly placed due to Cocoa annoying "origin is at the bottom left" feature, which means that when you resize an NSView, you also need to change the frame origin.
"In Cocoa, the origin is the bottom left. So when you adjust the view's height, the bottom of the view will stay the same and the top will change. To do what you want to do, you need to adjust the frame height and origin at the same time."
Users browsing this forum: No registered users and 1 guest