summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformscreen.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-06-05 12:22:02 +0200
committerChristian Stromme <christian.stromme@digia.com>2014-06-13 21:54:02 +0200
commitfb3f47b638fcdeb68c68fbda4943f4fbb22261c6 (patch)
treef4f66c7ce94a1f3578a2bb42e3912424b2b888e3 /src/plugins/platforms/android/qandroidplatformscreen.cpp
parent9c80a3be4b3beb28a3a6bda717c15b0ded523557 (diff)
Android: Report something sensible for screen geometry
We can't get the actual screen geometry on Android, but in Qt 5.3.0 we would always return the screen geometry minus the size of the status bar. After the available geometry was initialized to 0x0 instead of this arbitrary value, some applications that depended on this as a constant value would break if they collected the information before the window surface had been initialized and they forgot to listen to QScreen::geometryChanged(). To reduce the risk of regressions, this patch makes sure we return the same thing as before for the screen geometry and that this is not linked directly to the available screen geometry. Task-number: QTBUG-39464 Change-Id: Ie63337b3b10d2eb5130e4fece6c5b144e8230164 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformscreen.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index 11472ce1da..631032d80b 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -86,7 +86,8 @@ private:
QAndroidPlatformScreen::QAndroidPlatformScreen():QObject(),QPlatformScreen()
{
- m_geometry = QRect(0, 0, QAndroidPlatformIntegration::m_defaultGeometryWidth, QAndroidPlatformIntegration::m_defaultGeometryHeight);
+ m_availableGeometry = QRect(0, 0, QAndroidPlatformIntegration::m_defaultGeometryWidth, QAndroidPlatformIntegration::m_defaultGeometryHeight);
+ m_size = QSize(QAndroidPlatformIntegration::m_defaultScreenWidth, QAndroidPlatformIntegration::m_defaultScreenHeight);
// Raster only apps should set QT_ANDROID_RASTER_IMAGE_DEPTH to 16
// is way much faster than 32
if (qgetenv("QT_ANDROID_RASTER_IMAGE_DEPTH").toInt() == 16) {
@@ -204,7 +205,7 @@ void QAndroidPlatformScreen::scheduleUpdate()
void QAndroidPlatformScreen::setDirty(const QRect &rect)
{
- QRect intersection = rect.intersected(m_geometry);
+ QRect intersection = rect.intersected(m_availableGeometry);
m_dirtyRect |= intersection;
scheduleUpdate();
}
@@ -214,15 +215,21 @@ void QAndroidPlatformScreen::setPhysicalSize(const QSize &size)
m_physicalSize = size;
}
-void QAndroidPlatformScreen::setGeometry(const QRect &rect)
+void QAndroidPlatformScreen::setSize(const QSize &size)
+{
+ m_size = size;
+ QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
+}
+
+void QAndroidPlatformScreen::setAvailableGeometry(const QRect &rect)
{
QMutexLocker lock(&m_surfaceMutex);
- if (m_geometry == rect)
+ if (m_availableGeometry == rect)
return;
- QRect oldGeometry = m_geometry;
+ QRect oldGeometry = m_availableGeometry;
- m_geometry = rect;
+ m_availableGeometry = rect;
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
resizeMaximizedWindows();
@@ -271,7 +278,7 @@ void QAndroidPlatformScreen::doRedraw()
QMutexLocker lock(&m_surfaceMutex);
if (m_id == -1 && m_rasterSurfaces) {
- m_id = QtAndroid::createSurface(this, m_geometry, true, m_depth);
+ m_id = QtAndroid::createSurface(this, m_availableGeometry, true, m_depth);
m_surfaceWaitCondition.wait(&m_surfaceMutex);
}