Android: Properly update geometry once the platform plugin is ready

This is amends commit 9091a058bc61e29 to make sure we don't drop
geometry updates that are set before the platform plugins is ready.

Task-number: QTBUG-60963
Change-Id: I4489eb9329bb8983458ad328a43b85382bba3cf6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Christian Strømme 2017-05-23 16:41:42 +02:00 committed by Christian Stromme
parent 147aa29162
commit b684ed6bd7
3 changed files with 12 additions and 0 deletions

View File

@ -142,6 +142,7 @@ namespace QtAndroid
// flush the pending state if necessary.
if (m_androidPlatformIntegration) {
flushPendingApplicationState();
m_androidPlatformIntegration->flushPendingUpdates();
} else {
QMutexLocker locker(&m_pendingAppStateMtx);
m_pendingApplicationState = -1;
@ -627,6 +628,7 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
m_scaledDensity = scaledDensity;
m_density = density;
QMutexLocker lock(&m_surfacesMutex);
if (!m_androidPlatformIntegration) {
QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,
desktopHeightPixels,

View File

@ -405,6 +405,14 @@ void QAndroidPlatformIntegration::setScreenOrientation(Qt::ScreenOrientation cur
m_nativeOrientation = nativeOrientation;
}
void QAndroidPlatformIntegration::flushPendingUpdates()
{
m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth,
m_defaultPhysicalSizeHeight));
m_primaryScreen->setSize(QSize(m_defaultScreenWidth, m_defaultScreenHeight));
m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
}
#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *QAndroidPlatformIntegration::accessibility() const
{

View File

@ -126,6 +126,8 @@ public:
QTouchDevice *touchDevice() const { return m_touchDevice; }
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
void flushPendingUpdates();
private:
EGLDisplay m_eglDisplay;
QTouchDevice *m_touchDevice;