From 95822e28e2b83730bab01b0c2f79f3c5a17d4090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:32:47 +0100 Subject: iOS: Don't claim that windows with zero width and/or height are exposed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When sending expose events to Qt, Qt will ask us if we're exposed, and we need to tell it that we're not, so that clients will not try to makeCurrent on a CA layer that has a zero width and/or height. Note that this only works because we flush expose events. Change-Id: Idfbe03a2f35681084061376a3c650a8da027fda4 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/ios/qioswindow.mm') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 0dd810bdf6..587ecad61c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -579,6 +579,11 @@ void QIOSWindow::applyGeometry(const QRect &rect) [m_view layoutIfNeeded]; } +bool QIOSWindow::isExposed() const +{ + return window()->isVisible() && !window()->geometry().isEmpty(); +} + void QIOSWindow::setWindowState(Qt::WindowState state) { // Update the QWindow representation straight away, so that -- cgit v1.2.3 From cd1ce77bf8a3520dee1c2703405c2bf2762360a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:35:28 +0100 Subject: iOS: Apply default geometry to platform window if not set on QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a platform window is created from a QWindow without setting a valid size or position on the QWindow, the platform window is expected to apply sane defaults. We use the baseclass initialGeometry() function for this, similar to other platform plugins. The default geometry unless otherwise set and/or calculated based on size hints is that of the screen's available geometry. An improvement to this is to detect whenever we apply the screen geometry, and also apply the appropriate window state, but that needs more testing. Change-Id: I02b12064ce6d55c04fe0cc2cd1d2816ca1113f40 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/ios/qioswindow.mm') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 587ecad61c..7ab136e8b9 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -449,10 +449,18 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) - , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { 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->windowState()); } -- cgit v1.2.3