From 077e4993046ee5e564dfcc7710d07c905f2dee83 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 26 Feb 2019 11:55:15 +0100 Subject: [PATCH 1/5] Handle QMAKE_SUBSTITUTES input files as Latin 1 QMake's strategy is generally "pretend everything is Latin 1", which basically equals "do 8-bit pass-through". Change the handling of QMAKE_SUBSTITUTES input accordingly to avoid conversion losses when converting from and to UTF-8. Fixes: QTBUG-72130 Change-Id: Id903bbd2afa99708c92fd09fab3db944aa819a94 Reviewed-by: Oliver Wolff Reviewed-by: Kai Koehne --- qmake/generators/makefile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7762e47f413..ab261d02f19 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -532,7 +532,7 @@ MakefileGenerator::init() QStack state; enum { IN_CONDITION, MET_CONDITION, PENDING_CONDITION }; for (int count = 1; !in.atEnd(); ++count) { - QString line = QString::fromUtf8(in.readLine()); + QString line = QString::fromLatin1(in.readLine()); if (line.startsWith("!!IF ")) { if (state.isEmpty() || state.top() == IN_CONDITION) { QString test = line.mid(5, line.length()-(5+1)); @@ -578,7 +578,7 @@ MakefileGenerator::init() contents += project->expand(line, in.fileName(), count); } } - contentBytes = contents.toUtf8(); + contentBytes = contents.toLatin1(); } QFile out(outn); QFileInfo outfi(out); From 8880ef79311d283a1357ca0c14be6e56281ba5f0 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 11 Feb 2019 19:41:48 +0200 Subject: [PATCH 2/5] Terminate Qt gracefully When the application is closed via the task manager on Android then we need to ensure that that the application can close down any running event loops. So we wake up all the event loops and then call quit() directly on the application object to start a graceful termination of the application. In order to aid the graceful termination of Qt then a check is added to ensure that it does not try to create a new surface when the application is suspended. This prevents it from locking while trying to create a new surface when this is not possible. Fixes: QTBUG-70772 Change-Id: I6795b3d280e178d7f1207004a1b965a31a0cc9e9 Reviewed-by: Paul Olav Tvete Reviewed-by: Andy Shaw --- src/plugins/platforms/android/androidjnimain.cpp | 16 +++++++++------- .../android/qandroidplatformopenglwindow.cpp | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 13d41bea99c..74edfd83561 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -560,10 +560,15 @@ static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/) static void terminateQt(JNIEnv *env, jclass /*clazz*/) { // QAndroidEventDispatcherStopper is stopped when the user uses the task manager to kill the application - if (!QAndroidEventDispatcherStopper::instance()->stopped()) { - sem_wait(&m_terminateSemaphore); - sem_destroy(&m_terminateSemaphore); + if (QAndroidEventDispatcherStopper::instance()->stopped()) { + QAndroidEventDispatcherStopper::instance()->startAll(); + QCoreApplication::quit(); + QAndroidEventDispatcherStopper::instance()->goingToStop(false); } + + sem_wait(&m_terminateSemaphore); + sem_destroy(&m_terminateSemaphore); + env->DeleteGlobalRef(m_applicationClass); env->DeleteGlobalRef(m_classLoaderObject); if (m_resourcesObj) @@ -583,10 +588,7 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/) m_androidPlatformIntegration = nullptr; delete m_androidAssetsFileEngineHandler; m_androidAssetsFileEngineHandler = nullptr; - - if (!QAndroidEventDispatcherStopper::instance()->stopped()) { - sem_post(&m_exitSemaphore); - } + sem_post(&m_exitSemaphore); } static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h) diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 3e1cfe305d4..3de5d30623b 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -121,7 +122,7 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect) EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) { - if (QAndroidEventDispatcherStopper::stopped()) + if (QAndroidEventDispatcherStopper::stopped() || QGuiApplication::applicationState() == Qt::ApplicationSuspended) return m_eglSurface; QMutexLocker lock(&m_surfaceMutex); From 11c728713ff56c6c8e5fce60bde9147ddaafc802 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 11 Feb 2019 11:33:56 +0100 Subject: [PATCH 3/5] Android: Show correct keyboard when using Gboard and Japanese layout In 71a63836ed5d21feacbfcdbfdbd4b405f635282f a workaround for Samsung devices using ImhNoPredictiveText was included as there is a bug on those devices. However this causes a problem with other keyboards such as Gboard when using languages such as Japanese, as it would not show the right keyboard at all and only showed a qwerty one in those cases. Therefore we default to not working around the issue as it is more of a problem to not allow certain keyboard layouts as opposed to having predictive text even if it is turned off. For those who want to disable predictive text and as such have the consequences of not showing some keyboard layouts, they can set the QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT environment variable. [ChangeLog][Platform Specific Changes][Android] Text fields with ImhNoPredictiveText set are no longer working around keyboards that disregard this setting. To enforce the workaround then the environment variable - QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT should be set. Change-Id: I9ace7ba96ebad68987b53783e25067b66c002f25 Reviewed-by: Paul Olav Tvete --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 4b87c257879..350c6eee96d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -346,7 +346,9 @@ public class QtActivityDelegate } } else if ((inputHints & ImhHiddenText) != 0) { inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; - } else if ((inputHints & ImhSensitiveData) != 0 || (inputHints & ImhNoPredictiveText) != 0) { + } else if ((inputHints & ImhSensitiveData) != 0 || + ((inputHints & ImhNoPredictiveText) != 0 && + System.getenv("QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT") != null)) { inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; } From 20063cf99995f45c16e5c6952eb1d7609324be9f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 14 Feb 2019 16:06:44 +0100 Subject: [PATCH 4/5] Actively discard return value of qtConfGetNextCommandlineArg Calling a qmake replace function without assignment is undefined behavior. This amends 11ae0e77. Change-Id: Ie716f295275d1ba79a217745b332a8eca04b355d Reviewed-by: Oliver Wolff --- mkspecs/features/qt_configure.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 7ca65c92b3f..e845bf15770 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -338,7 +338,7 @@ defineTest(qtConfParseCommandLine) { qtConfAddWarning("Command line option -skip is only effective in top-level builds.") skipOptionWarningAdded = 1 } - $$qtConfGetNextCommandlineArg() + val = $$qtConfGetNextCommandlineArg() next() } From f5850cb0da5d9b610711d4fd3c1eaded9d6414e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Mon, 18 Feb 2019 12:30:29 +0100 Subject: [PATCH 5/5] CMake: fix generation of config files for external Qt modules When such modules aren't following the libQt5Foo.so naming convention, the generated CMake files would be incorrect. Change-Id: I57908f7466bff7a05f19271ccd495849476bdf38 Reviewed-by: Simon Hausmann Reviewed-by: Paul Lemire Reviewed-by: Joerg Bornemann Reviewed-by: Kevin Funk --- mkspecs/features/create_cmake.prf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 2ed708e0853..6bf1380716d 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -200,7 +200,9 @@ CMAKE_QT5_MODULE_DEPS = $$join(lib_deps, ";") CMAKE_INTERFACE_MODULE_DEPS = $$join(aux_mod_deps, ";") CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";") -CMAKE_QT_STEM = Qt$$QT_MAJOR_VERSION$${CMAKE_MODULE_NAME}$${QT_LIBINFIX} +# TARGET here is the one changed at the end of qt_module.prf, +# which already contains the Qt5 prefix and QT_LIBINFIX suffix +CMAKE_QT_STEM = $${TARGET} mac { !isEmpty(CMAKE_STATIC_TYPE) {