2012-10-30 13:55:46 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2016-01-15 07:08:27 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-10-30 13:55:46 +00:00
|
|
|
**
|
|
|
|
** This file is part of the plugins of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 07:08:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
2012-11-06 15:24:19 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 07:08:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-11-06 15:24:19 +00:00
|
|
|
**
|
2012-10-30 13:55:46 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-11-06 15:24:19 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2016-01-15 07:08:27 +00:00
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
2012-10-30 13:55:46 +00:00
|
|
|
**
|
2016-01-15 07:08:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 2.0 or (at your option) the GNU General
|
|
|
|
** Public license version 3 or any later version approved by the KDE Free
|
|
|
|
** Qt Foundation. The licenses are as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-10-30 13:55:46 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QIOSWINDOW_H
|
|
|
|
#define QIOSWINDOW_H
|
|
|
|
|
|
|
|
#include <qpa/qplatformwindow.h>
|
2013-01-22 11:00:19 +00:00
|
|
|
#include <qpa/qwindowsysteminterface.h>
|
2012-10-30 13:55:46 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
2012-11-06 15:24:19 +00:00
|
|
|
|
|
|
|
class QIOSContext;
|
2012-11-07 21:57:17 +00:00
|
|
|
class QIOSWindow;
|
2012-10-30 13:55:46 +00:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2013-11-07 11:20:28 +00:00
|
|
|
@class QUIView;
|
|
|
|
|
2013-11-11 14:17:56 +00:00
|
|
|
class QIOSWindow : public QObject, public QPlatformWindow
|
2012-10-30 13:55:46 +00:00
|
|
|
{
|
2013-11-11 14:17:56 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-10-30 13:55:46 +00:00
|
|
|
public:
|
|
|
|
explicit QIOSWindow(QWindow *window);
|
|
|
|
~QIOSWindow();
|
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
|
2012-10-30 13:55:46 +00:00
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE;
|
|
|
|
void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
|
|
|
|
void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
|
|
|
|
void setVisible(bool visible) Q_DECL_OVERRIDE;
|
2014-07-25 14:03:28 +00:00
|
|
|
void setOpacity(qreal level) Q_DECL_OVERRIDE;
|
2012-11-09 16:20:47 +00:00
|
|
|
|
2013-12-04 15:32:47 +00:00
|
|
|
bool isExposed() const Q_DECL_OVERRIDE;
|
2014-11-25 13:23:48 +00:00
|
|
|
void propagateSizeHints() Q_DECL_OVERRIDE {}
|
2013-12-04 15:32:47 +00:00
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); }
|
|
|
|
void lower() Q_DECL_OVERRIDE { raiseOrLower(false); }
|
2014-10-15 15:33:27 +00:00
|
|
|
|
|
|
|
bool shouldAutoActivateWindow() const;
|
2015-07-24 09:37:42 +00:00
|
|
|
void requestActivateWindow() Q_DECL_OVERRIDE;
|
2013-01-02 11:53:43 +00:00
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
qreal devicePixelRatio() const Q_DECL_OVERRIDE;
|
2012-10-30 13:55:46 +00:00
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
|
|
|
|
bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
|
2013-04-18 09:05:06 +00:00
|
|
|
|
2015-07-24 09:37:42 +00:00
|
|
|
WId winId() const Q_DECL_OVERRIDE { return WId(m_view); }
|
2012-10-30 13:55:46 +00:00
|
|
|
|
2014-05-19 10:28:32 +00:00
|
|
|
void clearAccessibleCache();
|
|
|
|
|
2015-06-23 21:37:10 +00:00
|
|
|
QSurfaceFormat format() const Q_DECL_OVERRIDE;
|
|
|
|
|
2016-06-01 11:29:28 +00:00
|
|
|
void requestUpdate() Q_DECL_OVERRIDE;
|
|
|
|
|
UIKit: Don't reallocate renderbuffer on QIOSContext::swapBuffers()
During device rotation, the backing CEAGLLayer of our custom UIView is
resized by the system. Normally this is the time where we would then
reconfigure the corresponding renderbuffer that we render to, which
shares memory with the CEAGLLayer, but we chose a lazy approach where
we'd defer the reconfigure until client code actually called makeCurrent.
This caused problems because not only did we implement the lazy reconfig
in makeCurrent, but in every QIOSContext function that operated on the
default FBO, including swapBuffers(). When using threaded rendering,
such as in Qt Quick, the render thread may be half way in rendering a
new frame when the system resizes the CEAGLLayer, and we pick up that
resize on the swapBuffer call and allocate a new renderbuffer, before
flushing the queued up GL commands that were operating on another
renderbuffer of a different size. This resulted in the following crash:
0 - gpus_ReturnObjectErrorKillClient()
1 - gpusSubmitDataBuffers()
2 - glrFlushContextToken()
3 - flush(__GLIContextRec*)()
4 - QIOSContext::swapBuffers(QPlatformSurface*)
...
We solve this by still being lazy in how we reconfigure, but limit the
reconfigure to makeCurrent(). If the CEAGLLayer is resized in between
two frames, we skip the half-drawn frame. The old frame will then be
scaled to match the new size by the system, but this is preferable to
flushing a new frame that may have been drawn with two conflicting
window geometries.
Task-number: QTBUG-50017
Change-Id: Ie229f26d156dfbfc7ed8d9efd0eb5e992eee73f1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2016-06-01 11:29:24 +00:00
|
|
|
CAEAGLLayer *eaglLayer() const;
|
|
|
|
|
2012-10-30 13:55:46 +00:00
|
|
|
private:
|
2014-04-24 13:33:20 +00:00
|
|
|
void applicationStateChanged(Qt::ApplicationState state);
|
2013-11-20 16:33:48 +00:00
|
|
|
void applyGeometry(const QRect &rect);
|
|
|
|
|
2013-11-07 11:20:28 +00:00
|
|
|
QUIView *m_view;
|
2013-01-22 11:00:19 +00:00
|
|
|
|
2013-11-06 14:36:30 +00:00
|
|
|
QRect m_normalGeometry;
|
2013-01-25 10:49:34 +00:00
|
|
|
int m_windowLevel;
|
2013-01-02 11:53:43 +00:00
|
|
|
|
|
|
|
void raiseOrLower(bool raise);
|
2013-01-25 10:49:34 +00:00
|
|
|
void updateWindowLevel();
|
2013-01-25 10:00:54 +00:00
|
|
|
bool blockedByModal();
|
2013-04-26 08:05:18 +00:00
|
|
|
|
2013-11-20 16:33:48 +00:00
|
|
|
friend class QIOSScreen;
|
2012-10-30 13:55:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // QIOSWINDOW_H
|