summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2013-10-18 12:42:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-25 09:52:37 +0200
commit8fd9fe209934ac92210ed3b81723ad5e21a98a30 (patch)
tree76c86b2c40996b84e3c9397b3061ca2b302e41f4 /src/plugins/platforms
parentf609e65a911efad7472a18fcbed983936af116b8 (diff)
Android: Fix repaint on rotation
After f89f099c55576992b39a8021aace64ff32747624, we no longer post a geometry-change and expose event when calling setGeometry, which the Android plugin depended on. This caused the window to stay the same size when it was resized by orientation changes. We put back the events in the code that calls setGeometry() instead. Task-number: QTBUG-32878 Change-Id: I449515dda07c839e0991c5a7031a972ca9c74dff Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.cpp15
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.h1
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp2
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp5
-rw-r--r--src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp2
5 files changed, 10 insertions, 15 deletions
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp
index 5c9ca798a8..34413ae509 100644
--- a/src/plugins/platforms/android/src/androidjnimain.cpp
+++ b/src/plugins/platforms/android/src/androidjnimain.cpp
@@ -247,17 +247,6 @@ namespace QtAndroid
m_surfaceMutex.unlock();
return m_nativeWindow;
}
-
- QSize nativeWindowSize()
- {
- if (m_nativeWindow == 0)
- return QAndroidPlatformIntegration::defaultDesktopSize();
-
- int width = ANativeWindow_getWidth(m_nativeWindow);
- int height = ANativeWindow_getHeight(m_nativeWindow);
-
- return QSize(width, height);
- }
#endif
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration)
@@ -564,7 +553,9 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface)
m_waitForWindowSemaphore.release();
if (m_androidPlatformIntegration) {
- QSize size = QtAndroid::nativeWindowSize();
+ // Use the desktop size.
+ // On some devices, the getters for the native window size gives wrong values
+ QSize size = QAndroidPlatformIntegration::defaultDesktopSize();
QPlatformScreen *screen = m_androidPlatformIntegration->screen();
QRect geometry(QPoint(0, 0), size);
diff --git a/src/plugins/platforms/android/src/androidjnimain.h b/src/plugins/platforms/android/src/androidjnimain.h
index 9a3d8a9607..b530aac884 100644
--- a/src/plugins/platforms/android/src/androidjnimain.h
+++ b/src/plugins/platforms/android/src/androidjnimain.h
@@ -75,7 +75,6 @@ namespace QtAndroid
void flushImage(const QPoint &pos, const QImage &image, const QRect &rect);
#else
EGLNativeWindowType nativeWindow(bool waitToCreate = true);
- QSize nativeWindowSize();
#endif
QWindow *topLevelWindowAt(const QPoint &globalPos);
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
index 9d6d4003f7..6431914812 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
@@ -71,6 +71,8 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
if (size.isValid()) {
QRect geometry(QPoint(0, 0), size);
window->setGeometry(geometry);
+ QWindowSystemInterface::handleGeometryChange(window->window(), geometry);
+ QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(geometry));
window->scheduleResize(QSize());
}
window->unlock();
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
index 4934047af9..258a0968e8 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
@@ -41,6 +41,7 @@
#include "qandroidopenglplatformwindow.h"
#include "androidjnimain.h"
+#include "qandroidplatformintegration.h"
#include <qpa/qwindowsysteminterface.h>
QT_BEGIN_NAMESPACE
@@ -110,7 +111,9 @@ void QAndroidOpenGLPlatformWindow::resetSurface()
{
lock();
- scheduleResize(QtAndroid::nativeWindowSize());
+ // Use the desktop size.
+ // On some devices, the getters for the native window size gives wrong values
+ scheduleResize(QAndroidPlatformIntegration::defaultDesktopSize());
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
unlock();
}
diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
index 338966eb40..e7e53e72a2 100644
--- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
+++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
@@ -82,7 +82,7 @@ EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const
QSize QEglFSAndroidHooks::screenSize() const
{
- return QtAndroid::nativeWindowSize();
+ return QAndroidPlatformIntegration::defaultDesktopSize();
}
QSizeF QEglFSAndroidHooks::physicalScreenSize() const