summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/gradle_export_util.cpp3
-rw-r--r--platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt23
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotLib.java7
-rw-r--r--platform/android/java_godot_lib_jni.cpp16
-rw-r--r--platform/android/java_godot_lib_jni.h1
-rw-r--r--platform/linuxbsd/tts_linux.cpp135
-rw-r--r--platform/linuxbsd/tts_linux.h8
-rw-r--r--platform/macos/display_server_macos.mm2
-rw-r--r--platform/windows/export/export_plugin.cpp5
9 files changed, 129 insertions, 71 deletions
diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp
index b889d58199..61f8c5574b 100644
--- a/platform/android/export/gradle_export_util.cpp
+++ b/platform/android/export/gradle_export_util.cpp
@@ -305,6 +305,9 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset, bool p_uses_xr
" <!-- OpenXR category tag to indicate the activity starts in an immersive OpenXR mode. \n"
" See https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#android-runtime-category. -->\n"
" <category android:name=\"org.khronos.openxr.intent.category.IMMERSIVE_HMD\" />\n"
+ "\n"
+ " <!-- Enable VR access on HTC Vive Focus devices. -->\n"
+ " <category android:name=\"com.htc.intent.category.VRAPP\" />\n"
" </intent-filter>\n";
} else {
manifest_activity_text += " <intent-filter>\n"
diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
index 71385315ae..42ef1436f3 100644
--- a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
+++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
@@ -40,6 +40,7 @@ import android.util.Log
import android.widget.Toast
import androidx.window.layout.WindowMetricsCalculator
import org.godotengine.godot.FullScreenGodotApp
+import org.godotengine.godot.GodotLib
import org.godotengine.godot.utils.PermissionsUtil
import org.godotengine.godot.utils.ProcessPhoenix
import java.util.*
@@ -90,11 +91,19 @@ open class GodotEditor : FullScreenGodotApp() {
}
super.onCreate(savedInstanceState)
+ }
+
+ override fun onGodotSetupCompleted() {
+ super.onGodotSetupCompleted()
+ val longPressEnabled = enableLongPressGestures()
+ val panScaleEnabled = enablePanAndScaleGestures()
- // Enable long press, panning and scaling gestures
- godotFragment?.renderView?.inputHandler?.apply {
- enableLongPress(enableLongPressGestures())
- enablePanningAndScalingGestures(enablePanAndScaleGestures())
+ runOnUiThread {
+ // Enable long press, panning and scaling gestures
+ godotFragment?.renderView?.inputHandler?.apply {
+ enableLongPress(longPressEnabled)
+ enablePanningAndScalingGestures(panScaleEnabled)
+ }
}
}
@@ -210,12 +219,14 @@ open class GodotEditor : FullScreenGodotApp() {
/**
* Enable long press gestures for the Godot Android editor.
*/
- protected open fun enableLongPressGestures() = true
+ protected open fun enableLongPressGestures() =
+ java.lang.Boolean.parseBoolean(GodotLib.getEditorSetting("interface/touchscreen/enable_long_press_as_right_click"))
/**
* Enable pan and scale gestures for the Godot Android editor.
*/
- protected open fun enablePanAndScaleGestures() = true
+ protected open fun enablePanAndScaleGestures() =
+ java.lang.Boolean.parseBoolean(GodotLib.getEditorSetting("interface/touchscreen/enable_pan_and_scale_gestures"))
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
index 75a01dc787..d9aab950df 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
@@ -190,6 +190,13 @@ public class GodotLib {
public static native String getGlobal(String p_key);
/**
+ * Used to access Godot's editor settings.
+ * @param settingKey Setting key
+ * @return String value of the setting
+ */
+ public static native String getEditorSetting(String settingKey);
+
+ /**
* Invoke method |p_method| on the Godot object specified by |p_id|
* @param p_id Id of the Godot object to invoke
* @param p_method Name of the method to invoke
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index e7abe580f1..1a0087e18d 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -57,6 +57,10 @@
#include <android/native_window_jni.h>
+#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#endif
+
static JavaClassWrapper *java_class_wrapper = nullptr;
static OS_Android *os_android = nullptr;
static AndroidInputHandler *input_handler = nullptr;
@@ -427,6 +431,18 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *
return env->NewStringUTF(GLOBAL_GET(js).operator String().utf8().get_data());
}
+JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) {
+ String editor_setting = "";
+#ifdef TOOLS_ENABLED
+ String godot_setting_key = jstring_to_string(p_setting_key, env);
+ editor_setting = EDITOR_GET(godot_setting_key).operator String();
+#else
+ WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
+#endif
+
+ return env->NewStringUTF(editor_setting.utf8().get_data());
+}
+
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params) {
Object *obj = ObjectDB::get_instance(ObjectID(ID));
ERR_FAIL_NULL(obj);
diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h
index 0020ddffd2..59ab2448d7 100644
--- a/platform/android/java_godot_lib_jni.h
+++ b/platform/android/java_godot_lib_jni.h
@@ -61,6 +61,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz);
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path);
+JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height);
diff --git a/platform/linuxbsd/tts_linux.cpp b/platform/linuxbsd/tts_linux.cpp
index 04d7c5444f..6b8584ef6c 100644
--- a/platform/linuxbsd/tts_linux.cpp
+++ b/platform/linuxbsd/tts_linux.cpp
@@ -35,6 +35,11 @@
TTS_Linux *TTS_Linux::singleton = nullptr;
+void TTS_Linux::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_speech_event", "msg_id", "client_id", "type"), &TTS_Linux::_speech_event);
+ ClassDB::bind_method(D_METHOD("_speech_index_mark", "msg_id", "client_id", "type", "index_mark"), &TTS_Linux::_speech_index_mark);
+}
+
void TTS_Linux::speech_init_thread_func(void *p_userdata) {
TTS_Linux *tts = (TTS_Linux *)p_userdata;
if (tts) {
@@ -76,76 +81,84 @@ void TTS_Linux::speech_init_thread_func(void *p_userdata) {
void TTS_Linux::speech_event_index_mark(size_t p_msg_id, size_t p_client_id, SPDNotificationType p_type, char *p_index_mark) {
TTS_Linux *tts = TTS_Linux::get_singleton();
- if (tts && tts->ids.has(p_msg_id)) {
- MutexLock thread_safe_method(tts->_thread_safe_);
- // Get word offset from the index mark injected to the text stream.
- String mark = String::utf8(p_index_mark);
- DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_BOUNDARY, tts->ids[p_msg_id], mark.to_int());
+ if (tts) {
+ tts->call_deferred(SNAME("_speech_index_mark"), p_msg_id, p_client_id, (int)p_type, String::utf8(p_index_mark));
+ }
+}
+
+void TTS_Linux::_speech_index_mark(size_t p_msg_id, size_t p_client_id, int p_type, const String &p_index_mark) {
+ _THREAD_SAFE_METHOD_
+
+ if (ids.has(p_msg_id)) {
+ DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_BOUNDARY, ids[p_msg_id], p_index_mark.to_int());
}
}
void TTS_Linux::speech_event_callback(size_t p_msg_id, size_t p_client_id, SPDNotificationType p_type) {
TTS_Linux *tts = TTS_Linux::get_singleton();
if (tts) {
- MutexLock thread_safe_method(tts->_thread_safe_);
- List<DisplayServer::TTSUtterance> &queue = tts->queue;
- if (!tts->paused && tts->ids.has(p_msg_id)) {
- if (p_type == SPD_EVENT_END) {
- DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_ENDED, tts->ids[p_msg_id]);
- tts->ids.erase(p_msg_id);
- tts->last_msg_id = -1;
- tts->speaking = false;
- } else if (p_type == SPD_EVENT_CANCEL) {
- DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, tts->ids[p_msg_id]);
- tts->ids.erase(p_msg_id);
- tts->last_msg_id = -1;
- tts->speaking = false;
- }
+ tts->call_deferred(SNAME("_speech_event"), p_msg_id, p_client_id, (int)p_type);
+ }
+}
+
+void TTS_Linux::_speech_event(size_t p_msg_id, size_t p_client_id, int p_type) {
+ _THREAD_SAFE_METHOD_
+
+ if (!paused && ids.has(p_msg_id)) {
+ if ((SPDNotificationType)p_type == SPD_EVENT_END) {
+ DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_ENDED, ids[p_msg_id]);
+ ids.erase(p_msg_id);
+ last_msg_id = -1;
+ speaking = false;
+ } else if ((SPDNotificationType)p_type == SPD_EVENT_CANCEL) {
+ DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, ids[p_msg_id]);
+ ids.erase(p_msg_id);
+ last_msg_id = -1;
+ speaking = false;
}
- if (!tts->speaking && queue.size() > 0) {
- DisplayServer::TTSUtterance &message = queue.front()->get();
-
- // Inject index mark after each word.
- String text;
- String language;
- SPDVoice **voices = spd_list_synthesis_voices(tts->synth);
- if (voices != nullptr) {
- SPDVoice **voices_ptr = voices;
- while (*voices_ptr != nullptr) {
- if (String::utf8((*voices_ptr)->name) == message.voice) {
- language = String::utf8((*voices_ptr)->language);
- break;
- }
- voices_ptr++;
- }
- free_spd_voices(voices);
- }
- PackedInt32Array breaks = TS->string_get_word_breaks(message.text, language);
- for (int i = 0; i < breaks.size(); i += 2) {
- const int start = breaks[i];
- const int end = breaks[i + 1];
- text += message.text.substr(start, end - start + 1);
- text += "<mark name=\"" + String::num_int64(end, 10) + "\"/>";
- }
+ }
+ if (!speaking && queue.size() > 0) {
+ DisplayServer::TTSUtterance &message = queue.front()->get();
- spd_set_synthesis_voice(tts->synth, message.voice.utf8().get_data());
- spd_set_volume(tts->synth, message.volume * 2 - 100);
- spd_set_voice_pitch(tts->synth, (message.pitch - 1) * 100);
- float rate = 0;
- if (message.rate > 1.f) {
- rate = log10(MIN(message.rate, 2.5f)) / log10(2.5f) * 100;
- } else if (message.rate < 1.f) {
- rate = log10(MAX(message.rate, 0.5f)) / log10(0.5f) * -100;
+ // Inject index mark after each word.
+ String text;
+ String language;
+ SPDVoice **voices = spd_list_synthesis_voices(synth);
+ if (voices != nullptr) {
+ SPDVoice **voices_ptr = voices;
+ while (*voices_ptr != nullptr) {
+ if (String::utf8((*voices_ptr)->name) == message.voice) {
+ language = String::utf8((*voices_ptr)->language);
+ break;
+ }
+ voices_ptr++;
}
- spd_set_voice_rate(tts->synth, rate);
- spd_set_data_mode(tts->synth, SPD_DATA_SSML);
- tts->last_msg_id = spd_say(tts->synth, SPD_TEXT, text.utf8().get_data());
- tts->ids[tts->last_msg_id] = message.id;
- DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
-
- queue.pop_front();
- tts->speaking = true;
+ free_spd_voices(voices);
}
+ PackedInt32Array breaks = TS->string_get_word_breaks(message.text, language);
+ for (int i = 0; i < breaks.size(); i += 2) {
+ const int start = breaks[i];
+ const int end = breaks[i + 1];
+ text += message.text.substr(start, end - start + 1);
+ text += "<mark name=\"" + String::num_int64(end, 10) + "\"/>";
+ }
+ spd_set_synthesis_voice(synth, message.voice.utf8().get_data());
+ spd_set_volume(synth, message.volume * 2 - 100);
+ spd_set_voice_pitch(synth, (message.pitch - 1) * 100);
+ float rate = 0;
+ if (message.rate > 1.f) {
+ rate = log10(MIN(message.rate, 2.5f)) / log10(2.5f) * 100;
+ } else if (message.rate < 1.f) {
+ rate = log10(MAX(message.rate, 0.5f)) / log10(0.5f) * -100;
+ }
+ spd_set_voice_rate(synth, rate);
+ spd_set_data_mode(synth, SPD_DATA_SSML);
+ last_msg_id = spd_say(synth, SPD_TEXT, text.utf8().get_data());
+ ids[last_msg_id] = message.id;
+ DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
+
+ queue.pop_front();
+ speaking = true;
}
}
@@ -204,7 +217,7 @@ void TTS_Linux::speak(const String &p_text, const String &p_voice, int p_volume,
if (is_paused()) {
resume();
} else {
- speech_event_callback(0, 0, SPD_EVENT_BEGIN);
+ _speech_event(0, 0, (int)SPD_EVENT_BEGIN);
}
}
diff --git a/platform/linuxbsd/tts_linux.h b/platform/linuxbsd/tts_linux.h
index 3fe7b659d0..3fcbe3207b 100644
--- a/platform/linuxbsd/tts_linux.h
+++ b/platform/linuxbsd/tts_linux.h
@@ -45,7 +45,8 @@
#include <libspeechd.h>
#endif
-class TTS_Linux {
+class TTS_Linux : public Object {
+ GDCLASS(TTS_Linux, Object);
_THREAD_SAFE_CLASS_
List<DisplayServer::TTSUtterance> queue;
@@ -63,6 +64,11 @@ class TTS_Linux {
static TTS_Linux *singleton;
+protected:
+ static void _bind_methods();
+ void _speech_event(size_t p_msg_id, size_t p_client_id, int p_type);
+ void _speech_index_mark(size_t p_msg_id, size_t p_client_id, int p_type, const String &p_index_mark);
+
public:
static TTS_Linux *get_singleton();
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index 14778b5f03..e8eb5b419b 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -2024,7 +2024,7 @@ void DisplayServerMacOS::warp_mouse(const Point2i &p_position) {
// Local point in window coords.
const NSRect contentRect = [wd.window_view frame];
const float scale = screen_get_max_scale();
- NSRect pointInWindowRect = NSMakeRect(p_position.x / scale, contentRect.size.height - (p_position.y / scale - 1), 0, 0);
+ NSRect pointInWindowRect = NSMakeRect(p_position.x / scale, contentRect.size.height - (p_position.y / scale), scale, scale);
NSPoint pointOnScreen = [[wd.window_view window] convertRectToScreen:pointInWindowRect].origin;
// Point in scren coords.
diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp
index 4107a8a17e..22297f4c29 100644
--- a/platform/windows/export/export_plugin.cpp
+++ b/platform/windows/export/export_plugin.cpp
@@ -490,6 +490,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
return FAILED;
}
#else
+ int id_type = 1;
if (p_preset->get("codesign/identity") != "") {
args.push_back("-pkcs12");
args.push_back(p_preset->get("codesign/identity"));
@@ -500,7 +501,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
#endif
//password
- if (p_preset->get("codesign/password") != "") {
+ if ((id_type == 1) && (p_preset->get("codesign/password") != "")) {
#ifdef WINDOWS_ENABLED
args.push_back("/p");
#else
@@ -574,7 +575,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
String str;
Error err = OS::get_singleton()->execute(signtool_path, args, &str, nullptr, true);
if (err != OK || (str.find("not found") != -1) || (str.find("not recognized") != -1)) {
-#ifndef WINDOWS_ENABLED
+#ifdef WINDOWS_ENABLED
add_message(EXPORT_MESSAGE_WARNING, TTR("Code Signing"), TTR("Could not start signtool executable. Configure signtool path in the Editor Settings (Export > Windows > signtool), or disable \"Codesign\" in the export preset."));
#else
add_message(EXPORT_MESSAGE_WARNING, TTR("Code Signing"), TTR("Could not start osslsigncode executable. Configure signtool path in the Editor Settings (Export > Windows > osslsigncode), or disable \"Codesign\" in the export preset."));