summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjnimain.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/androidjnimain.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/androidjnimain.cpp')
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index f711a68a71..948b012399 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -549,7 +549,7 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface,
}
static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
- jint /*widthPixels*/, jint /*heightPixels*/,
+ jint widthPixels, jint heightPixels,
jint desktopWidthPixels, jint desktopHeightPixels,
jdouble xdpi, jdouble ydpi, jdouble scaledDensity)
{
@@ -558,13 +558,17 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
m_scaledDensity = scaledDensity;
if (!m_androidPlatformIntegration) {
- QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,desktopHeightPixels,
- qRound(double(desktopWidthPixels) / xdpi * 25.4),
- qRound(double(desktopHeightPixels) / ydpi * 25.4));
+ QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,
+ desktopHeightPixels,
+ qRound(double(desktopWidthPixels) / xdpi * 25.4),
+ qRound(double(desktopHeightPixels) / ydpi * 25.4),
+ widthPixels,
+ heightPixels);
} else {
m_androidPlatformIntegration->setDisplayMetrics(qRound(double(desktopWidthPixels) / xdpi * 25.4),
qRound(double(desktopHeightPixels) / ydpi * 25.4));
m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
+ m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels);
}
}