diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-16 10:40:12 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-16 10:40:12 +0200 |
| commit | 39bc8aafa16b900346fd8c9ac02595864d91b836 (patch) | |
| tree | b5b012d471af0852beff7cf1c7b9f998a057d64b /platform/android | |
| parent | 4a6e8dc57bf55c96c60cdfb2a9cbfa2964f39b68 (diff) | |
| parent | c1a7222c97b7d5c2a1654722eff3c397da726610 (diff) | |
| download | redot-engine-39bc8aafa16b900346fd8c9ac02595864d91b836.tar.gz | |
Merge pull request #83173 from m4gr3d/fix_gestures_properties_retrieval_timing
Fix the timeframe when the Android gestures properties are retrieved
Diffstat (limited to 'platform/android')
| -rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.kt | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt index 04d196a6e9..857f239e96 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt @@ -389,9 +389,6 @@ class Godot(private val context: Context) : SensorEventListener { GodotGLRenderView(host, this, xrMode, useDebugOpengl) } - renderView?.inputHandler?.enableLongPress(java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_long_press_as_right_click"))) - renderView?.inputHandler?.enablePanningAndScalingGestures(java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_pan_and_scale_gestures"))) - if (host == primaryHost) { renderView!!.startRenderer() } @@ -575,6 +572,19 @@ class Godot(private val context: Context) : SensorEventListener { * Invoked on the render thread when the Godot setup is complete. */ private fun onGodotSetupCompleted() { + Log.d(TAG, "OnGodotSetupCompleted") + + // These properties are defined after Godot setup completion, so we retrieve them here. + val longPressEnabled = java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_long_press_as_right_click")) + val panScaleEnabled = java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_pan_and_scale_gestures")) + + runOnUiThread { + renderView?.inputHandler?.apply { + enableLongPress(longPressEnabled) + enablePanningAndScalingGestures(panScaleEnabled) + } + } + for (plugin in pluginRegistry.allPlugins) { plugin.onGodotSetupCompleted() } @@ -585,6 +595,8 @@ class Godot(private val context: Context) : SensorEventListener { * Invoked on the render thread when the Godot main loop has started. */ private fun onGodotMainLoopStarted() { + Log.d(TAG, "OnGodotMainLoopStarted") + for (plugin in pluginRegistry.allPlugins) { plugin.onGodotMainLoopStarted() } |
