From 7053df4b5b4d4d8e52ea7836f38e10e4ccc8e4ff Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 30 Nov 2020 17:23:04 +0000 Subject: [PATCH] iOS: Fixed incorrect desktop window position --- .../native/juce_ios_UIViewComponentPeer.mm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 9e735b455f..1daab29f74 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -632,12 +632,20 @@ void UIViewComponentPeer::setBounds (const Rectangle& newBounds, const bool Rectangle UIViewComponentPeer::getBounds (const bool global) const { - CGRect r = view.frame; + auto r = view.frame; - if (global && view.window != nil) + if (global) { - r = [view convertRect: r toView: view.window]; - r = [view.window convertRect: r toWindow: nil]; + if (view.window != nil) + { + r = [view convertRect: r toView: view.window]; + r = [view.window convertRect: r toWindow: nil]; + } + else if (window != nil) + { + r.origin.x += window.frame.origin.x; + r.origin.y += window.frame.origin.y; + } } return convertToRectInt (r);