summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-08-28 20:36:11 +0200
committerSergio Ahumada <sergio.ahumada@digia.com>2013-08-28 20:36:12 +0200
commit3b3a9fe53f23cf3ac1b41919be415af22362e4c5 (patch)
treeca9c4de823c9ca0b6240a0a62b821c6e646e667c /src/plugins/platforms
parente9c771d6cce35746fceeb9a2bed9f522a8d7f34c (diff)
parentc15a8cc283d5d7b26677b9c71cabb1f5f47494f1 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.cpp40
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp21
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h2
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.cpp1
4 files changed, 43 insertions, 21 deletions
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp
index 162a8aa977..74183b3107 100644
--- a/src/plugins/platforms/android/src/androidjnimain.cpp
+++ b/src/plugins/platforms/android/src/androidjnimain.cpp
@@ -555,33 +555,37 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface)
m_nativeWindow = nativeWindow;
if (m_waitForWindow)
m_waitForWindowSemaphore.release();
- if (m_androidPlatformIntegration && !sameNativeWindow) {
- m_surfaceMutex.unlock();
- m_androidPlatformIntegration->surfaceChanged();
- } else if (m_androidPlatformIntegration && sameNativeWindow) {
- QPlatformScreen *screen = m_androidPlatformIntegration->screen();
+
+ if (m_androidPlatformIntegration) {
QSize size = QtAndroid::nativeWindowSize();
+ QPlatformScreen *screen = m_androidPlatformIntegration->screen();
QRect geometry(QPoint(0, 0), size);
QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry);
QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry);
- // Resize all top level windows, since they share the same surface
- foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
- QAndroidOpenGLPlatformWindow *window =
- static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
-
- if (window != 0) {
- window->lock();
- window->scheduleResize(size);
-
- QWindowSystemInterface::handleExposeEvent(window->window(),
- QRegion(window->window()->geometry()));
- window->unlock();
+ if (!sameNativeWindow) {
+ m_surfaceMutex.unlock();
+ m_androidPlatformIntegration->surfaceChanged();
+ } else {
+ // Resize all top level windows, since they share the same surface
+ foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
+ QAndroidOpenGLPlatformWindow *window =
+ static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
+
+ if (window != 0) {
+ window->lock();
+ window->scheduleResize(size);
+
+ QWindowSystemInterface::handleExposeEvent(window->window(),
+ QRegion(window->window()->geometry()));
+ window->unlock();
+ }
}
+
+ m_surfaceMutex.unlock();
}
- m_surfaceMutex.unlock();
} else {
m_surfaceMutex.unlock();
}
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
index 24a7debd1f..2eac8d248c 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
@@ -84,9 +84,19 @@ void QAndroidOpenGLPlatformWindow::invalidateSurface()
}
}
+void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow()
+{
+ QWriteLocker locker(&m_staticSurfaceLock);
+ m_staticNativeWindow = QtAndroid::nativeWindow(false);
+}
+
void QAndroidOpenGLPlatformWindow::resetSurface()
{
- m_referenceCount.ref();
+ // Only add a reference if we're not already holding one, otherwise we're just updating
+ // the native window pointer
+ if (m_window == 0)
+ m_referenceCount.ref();
+
if (m_staticSurface == 0) {
QWriteLocker locker(&m_staticSurfaceLock);
QEglFSWindow::resetSurface();
@@ -94,12 +104,17 @@ void QAndroidOpenGLPlatformWindow::resetSurface()
m_staticNativeWindow = m_window;
} else {
QReadLocker locker(&m_staticSurfaceLock);
- Q_ASSERT(m_staticSurface != m_surface);
m_window = m_staticNativeWindow;
m_surface = m_staticSurface;
}
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
+ {
+ lock();
+ scheduleResize(QtAndroid::nativeWindowSize());
+ QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
+ unlock();
+ }
+
QWindowSystemInterface::flushWindowSystemEvents();
}
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
index 36a110e1a8..9a25957ccd 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
@@ -71,6 +71,8 @@ public:
void destroy();
+ static void updateStaticNativeWindow();
+
private:
QSize m_scheduledResize;
QMutex m_lock;
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
index 91ad2b368f..636a2b3853 100644
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
@@ -162,6 +162,7 @@ void QAndroidPlatformIntegration::invalidateNativeSurface()
void QAndroidPlatformIntegration::surfaceChanged()
{
+ QAndroidOpenGLPlatformWindow::updateStaticNativeWindow();
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QAndroidOpenGLPlatformWindow *window =
static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());