void setNativeHostWindowOrigin (Component* component, int newWidth, int newHeight)
{
JUCE_AUTORELEASEPOOL
#if JUCE_64BIT
NSView *childComp = (NSView*)component->getWindowHandle();
if (childComp != nil)
{
NSPoint frameOrigin = [childComp frame].origin;
frameOrigin.y += (newHeight - component->getHeight());
[childComp setFrameOrigin: frameOrigin];
}
#endif
}extern void setNativeHostWindowOrigin (Component *editorComp, int newWidth, int newHeight);void resizeHostWindow (int newWidth, int newHeight)
{
....
if (editorComp->getPeer() != nullptr)
editorComp->getPeer()->handleMovedOrResized();
#if JUCE_MAC
setNativeHostWindowOrigin (editorComp, newWidth, newHeight);
#endif
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.
From http://forums.macrumors.com/showthread.php?t=1064329
"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 2 guests