From 4e60681c879a54cf5b34862a30e27c492ed36363 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Thu, 14 Jan 2021 12:38:04 +0200 Subject: Make QJniObject and QJniEnvironment public API As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen --- src/plugins/platforms/android/androidjniinput.cpp | 46 +++++++++++------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/plugins/platforms/android/androidjniinput.cpp') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 5e4d271fcc..a72682dd23 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -49,7 +49,6 @@ #include #include -#include #include QT_BEGIN_NAMESPACE @@ -71,27 +70,26 @@ namespace QtAndroidInput #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd; #endif - QJNIObjectPrivate::callStaticMethod(applicationClass(), - "updateSelection", - "(IIII)V", - selStart, - selEnd, - candidatesStart, - candidatesEnd); + QJniObject::callStaticMethod(applicationClass(), + "updateSelection", + "(IIII)V", + selStart, + selEnd, + candidatesStart, + candidatesEnd); } void showSoftwareKeyboard(int left, int top, int width, int height, int inputHints, int enterKeyType) { - QJNIObjectPrivate::callStaticMethod(applicationClass(), - "showSoftwareKeyboard", - "(IIIIII)V", - left, - top, - width, - height, - inputHints, - enterKeyType - ); + QJniObject::callStaticMethod(applicationClass(), + "showSoftwareKeyboard", + "(IIIIII)V", + left, + top, + width, + height, + inputHints, + enterKeyType); #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug() << "@@@ SHOWSOFTWAREKEYBOARD" << left << top << width << height << inputHints << enterKeyType; #endif @@ -99,7 +97,7 @@ namespace QtAndroidInput void resetSoftwareKeyboard() { - QJNIObjectPrivate::callStaticMethod(applicationClass(), "resetSoftwareKeyboard"); + QJniObject::callStaticMethod(applicationClass(), "resetSoftwareKeyboard"); #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug("@@@ RESETSOFTWAREKEYBOARD"); #endif @@ -107,7 +105,7 @@ namespace QtAndroidInput void hideSoftwareKeyboard() { - QJNIObjectPrivate::callStaticMethod(applicationClass(), "hideSoftwareKeyboard"); + QJniObject::callStaticMethod(applicationClass(), "hideSoftwareKeyboard"); #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug("@@@ HIDESOFTWAREKEYBOARD"); #endif @@ -125,10 +123,10 @@ namespace QtAndroidInput void updateHandles(int mode, QPoint editMenuPos, uint32_t editButtons, QPoint cursor, QPoint anchor, bool rtl) { - QJNIObjectPrivate::callStaticMethod(applicationClass(), "updateHandles", "(IIIIIIIIZ)V", - mode, editMenuPos.x(), editMenuPos.y(), editButtons, - cursor.x(), cursor.y(), - anchor.x(), anchor.y(), rtl); + QJniObject::callStaticMethod(applicationClass(), "updateHandles", "(IIIIIIIIZ)V", + mode, editMenuPos.x(), editMenuPos.y(), editButtons, + cursor.x(), cursor.y(), + anchor.x(), anchor.y(), rtl); } static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y) -- cgit v1.2.3