Android: Fix repaint on rotation
After f89f099c55
, 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>
This commit is contained in:
parent
f609e65a91
commit
8fd9fe2099
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const
|
||||
|
||||
QSize QEglFSAndroidHooks::screenSize() const
|
||||
{
|
||||
return QtAndroid::nativeWindowSize();
|
||||
return QAndroidPlatformIntegration::defaultDesktopSize();
|
||||
}
|
||||
|
||||
QSizeF QEglFSAndroidHooks::physicalScreenSize() const
|
||||
|
Loading…
Reference in New Issue
Block a user