summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-11-13 09:49:51 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-11-13 19:14:59 +0100
commit93077dd1f237730a26714d77bb7e91542f96affc (patch)
treec3a73f691066b01057efe543718b66b2864aef2b /src/plugins/platforms
parent619ec1a6406a8be7bfa9d96b9e693e7a3323d8dc (diff)
iOS: Fix foreign window auto test
Pick-to: 6.6 Change-Id: Iae3a0f9805b02f935009d800dec00d9e2ceb008d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/ios/qioswindow.h2
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm32
2 files changed, 23 insertions, 11 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index 762a31af9a..1634213e06 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -62,6 +62,8 @@ public:
CAEAGLLayer *eaglLayer() const;
#endif
+ bool isForeignWindow() const override;
+
private:
void applicationStateChanged(Qt::ApplicationState state);
void applyGeometry(const QRect &rect);
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 3f1a15f854..ddbc63bb57 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -52,17 +52,22 @@ QIOSWindow::QIOSWindow(QWindow *window, WId nativeHandle)
setParent(QPlatformWindow::parent());
- // Resolve default window geometry in case it was not set before creating the
- // platform window. This picks up eg. minimum-size if set, and defaults to
- // the "maxmized" geometry (even though we're not in that window state).
- // FIXME: Detect if we apply a maximized geometry and send a window state
- // change event in that case.
- m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(),
- screen()->availableGeometry().width(), screen()->availableGeometry().height());
-
- setWindowState(window->windowStates());
- setOpacity(window->opacity());
- setMask(QHighDpi::toNativeLocalRegion(window->mask(), window));
+ if (!isForeignWindow()) {
+ // Resolve default window geometry in case it was not set before creating the
+ // platform window. This picks up eg. minimum-size if set, and defaults to
+ // the "maxmized" geometry (even though we're not in that window state).
+ // FIXME: Detect if we apply a maximized geometry and send a window state
+ // change event in that case.
+ m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(),
+ screen()->availableGeometry().width(), screen()->availableGeometry().height());
+
+ setWindowState(window->windowStates());
+ setOpacity(window->opacity());
+ setMask(QHighDpi::toNativeLocalRegion(window->mask(), window));
+ } else {
+ // Pick up essential foreign window state
+ QPlatformWindow::setGeometry(QRectF::fromCGRect(m_view.frame).toRect());
+ }
Qt::ScreenOrientation initialOrientation = window->contentOrientation();
if (initialOrientation != Qt::PrimaryOrientation) {
@@ -426,6 +431,11 @@ QUIView *quiview_cast(UIView *view)
return qt_objc_cast<QUIView *>(view);
}
+bool QIOSWindow::isForeignWindow() const
+{
+ return ![m_view isKindOfClass:QUIView.class];
+}
+
QT_END_NAMESPACE
#include "moc_qioswindow.cpp"