summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2013-04-15 11:23:04 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-18 09:18:43 +0200
commiteb95685556143eb71323742bfcdaa20541b01375 (patch)
treecb54d5314c95aa9eb9b1aa1f272e60aa7f38b702 /src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
parent1770f25857c7cfe21c36c0bda8a80a54b199bafe (diff)
Android: Don't crash when displaying multiple top-levels
While the raster platform plugin supports multiple top level windows, this is not supported on the GL plugin, so if you use GL or QtQuick2 in your app and use several top levels, the app would crash with an error message. A problem is that the top-level SurfaceView is a special overlay View and does not support being stacked in a layout. So instead, we let all windows share the same GL surface and draw on top of each other. This works fine for simple use cases. We implement a new platform capability to make sure no top level windows (even combobox popups and dialogs) get non-fullscreen geometries. That has never worked properly with the eglfs plugin. Task-number: QTBUG-30473 Change-Id: Ia1438019638fc739cc93ffe79b46b81631254df2 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp')
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
index aa8ee57341..4d741807d0 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
@@ -62,16 +62,16 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
{
QEglFSContext::swapBuffers(surface);
- QAndroidOpenGLPlatformWindow *primaryWindow = m_platformIntegration->primaryWindow();
- if (primaryWindow == surface) {
- primaryWindow->lock();
- QSize size = primaryWindow->scheduledResize();
+ if (surface->surface()->surfaceClass() == QSurface::Window) {
+ QAndroidOpenGLPlatformWindow *window = static_cast<QAndroidOpenGLPlatformWindow *>(surface);
+ window->lock();
+ QSize size = window->scheduledResize();
if (size.isValid()) {
QRect geometry(QPoint(0, 0), size);
- primaryWindow->setGeometry(geometry);
- primaryWindow->scheduleResize(QSize());
+ window->setGeometry(geometry);
+ window->scheduleResize(QSize());
}
- primaryWindow->unlock();
+ window->unlock();
}
}