diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 2088ca2669..a3af9354b5 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -228,13 +228,12 @@ public: Rectangle getBounds (const bool global) const { NSRect r = [view frame]; + NSWindow* window = [view window]; - if (global && [view window] != nil) + if (global && window != nil) { - r = [view convertRect: r toView: nil]; - NSRect wr = [[view window] frame]; - r.origin.x += wr.origin.x; - r.origin.y += wr.origin.y; + r = [[view superview] convertRect: r toView: nil]; + r = [window convertRectToScreen: r]; r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.origin.y - r.size.height; } else