summaryrefslogtreecommitdiff
path: root/platform/android/java_godot_view_wrapper.cpp
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@fb.com>2022-10-05 13:07:34 -0700
committerGitHub <noreply@github.com>2022-10-05 13:07:34 -0700
commitea9bb98f26be8212245f6ff796617901a8b9f3f6 (patch)
tree494aa473e2fd9489011299c59ad75d8435f1012a /platform/android/java_godot_view_wrapper.cpp
parent38113acf0d368eff1069c5daca57b5f5c4d9878e (diff)
parentffe0e3970fad624e93a560285ecb0addcd89215a (diff)
Merge pull request #66946 from m4gr3d/cursor_shape_logic_cleanup_main
Cleanup of the Android cursor shape logic
Diffstat (limited to 'platform/android/java_godot_view_wrapper.cpp')
-rw-r--r--platform/android/java_godot_view_wrapper.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/platform/android/java_godot_view_wrapper.cpp b/platform/android/java_godot_view_wrapper.cpp
index 0153ba96fc..762840a4b1 100644
--- a/platform/android/java_godot_view_wrapper.cpp
+++ b/platform/android/java_godot_view_wrapper.cpp
@@ -40,13 +40,24 @@ GodotJavaViewWrapper::GodotJavaViewWrapper(jobject godot_view) {
_cls = (jclass)env->NewGlobalRef(env->GetObjectClass(godot_view));
- if (android_get_device_api_level() >= __ANDROID_API_O__) {
+ int android_device_api_level = android_get_device_api_level();
+ if (android_device_api_level >= __ANDROID_API_N__) {
+ _set_pointer_icon = env->GetMethodID(_cls, "setPointerIcon", "(I)V");
+ }
+ if (android_device_api_level >= __ANDROID_API_O__) {
_request_pointer_capture = env->GetMethodID(_cls, "requestPointerCapture", "()V");
_release_pointer_capture = env->GetMethodID(_cls, "releasePointerCapture", "()V");
- _set_pointer_icon = env->GetMethodID(_cls, "setPointerIcon", "(I)V");
}
}
+bool GodotJavaViewWrapper::can_update_pointer_icon() const {
+ return _set_pointer_icon != nullptr;
+}
+
+bool GodotJavaViewWrapper::can_capture_pointer() const {
+ return _request_pointer_capture != nullptr && _release_pointer_capture != nullptr;
+}
+
void GodotJavaViewWrapper::request_pointer_capture() {
if (_request_pointer_capture != nullptr) {
JNIEnv *env = get_jni_env();