summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp60
-rw-r--r--platform/android/java/app/build.gradle2
-rw-r--r--platform/android/java/app/config.gradle4
-rw-r--r--platform/android/java/lib/build.gradle2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java2
-rw-r--r--platform/android/os_android.cpp3
-rw-r--r--platform/iphone/export/export.cpp8
-rw-r--r--platform/javascript/detect.py5
-rw-r--r--platform/javascript/export/export.cpp55
-rw-r--r--platform/javascript/http_request.js3
-rw-r--r--platform/javascript/id_handler.js5
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/detect.py18
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/osx/os_osx.mm30
-rw-r--r--platform/uwp/export/export.cpp8
-rw-r--r--platform/windows/detect.py7
-rw-r--r--platform/windows/export/export.cpp8
-rwxr-xr-xplatform/windows/os_windows.cpp4
-rw-r--r--platform/x11/os_x11.cpp15
-rw-r--r--platform/x11/os_x11.h1
21 files changed, 148 insertions, 96 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 0ebd97d428..78d87c5629 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -247,7 +247,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String name;
String description;
int api_level;
- bool usb;
};
struct APKExportData {
@@ -274,20 +273,17 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String devices;
List<String> args;
args.push_back("devices");
- args.push_back("-l");
int ec;
OS::get_singleton()->execute(adb, args, true, NULL, &devices, &ec);
Vector<String> ds = devices.split("\n");
Vector<String> ldevices;
- Vector<bool> ldevices_usbconnection;
for (int i = 1; i < ds.size(); i++) {
String d = ds[i];
- int dpos = d.find(" device ");
+ int dpos = d.find("device");
if (dpos == -1)
continue;
- ldevices_usbconnection.push_back(d.find(" usb:") != -1);
d = d.substr(0, dpos).strip_edges();
ldevices.push_back(d);
}
@@ -318,7 +314,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Device d;
d.id = ldevices[i];
- d.usb = ldevices_usbconnection[i];
for (int j = 0; j < ea->devices.size(); j++) {
if (ea->devices[j].id == ldevices[i]) {
d.description = ea->devices[j].description;
@@ -373,17 +368,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
} else if (p.begins_with("ro.opengles.version=")) {
uint32_t opengl = p.get_slice("=", 1).to_int();
d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl)&0xFF) + "\n";
- } else if (p.begins_with("ro.boot.serialno=")) {
- d.description += "Serial: " + p.get_slice("=", 1).strip_edges() + "\n";
}
}
- if (d.usb) {
- d.description += "Connection: USB\n";
- } else {
- d.description += "Connection: " + d.id + "\n";
- }
-
d.name = vendor + " " + device;
if (device == String()) continue;
}
@@ -623,7 +610,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
static Error save_apk_so(void *p_userdata, const SharedObject &p_so) {
if (!p_so.path.get_file().begins_with("lib")) {
String err = "Android .so file names must start with \"lib\", but got: " + p_so.path;
- ERR_PRINTS(err);
+ ERR_PRINT(err);
return FAILED;
}
APKExportData *ed = (APKExportData *)p_userdata;
@@ -644,7 +631,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
if (!exported) {
String abis_string = String(" ").join(abis);
String err = "Cannot determine ABI for library \"" + p_so.path + "\". One of the supported ABIs must be used as a tag: " + abis_string;
- ERR_PRINTS(err);
+ ERR_PRINT(err);
return FAILED;
}
return OK;
@@ -655,9 +642,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String dst_path = p_path.replace_first("res://", "assets/");
store_in_apk(ed, dst_path, p_data, _should_compress_asset(p_path, p_data) ? Z_DEFLATED : 0);
- if (ed->ep->step("File: " + p_path, 3 + p_file * 100 / p_total)) {
- return ERR_SKIP;
- }
return OK;
}
@@ -1495,28 +1479,28 @@ public:
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
ERR_FAIL_INDEX_V(p_device, devices.size(), ERR_INVALID_PARAMETER);
+
+ String can_export_error;
+ bool can_export_missing_templates;
+ if (!can_export(p_preset, can_export_error, can_export_missing_templates)) {
+ EditorNode::add_io_error(can_export_error);
+ return ERR_UNCONFIGURED;
+ }
+
device_lock->lock();
EditorProgress ep("run", "Running on " + devices[p_device].name, 3);
String adb = EditorSettings::get_singleton()->get("export/android/adb");
- if (adb == "") {
-
- EditorNode::add_io_error("ADB executable not configured in settings, can't run.");
- device_lock->unlock();
- return ERR_UNCONFIGURED;
- }
// Export_temp APK.
- if (ep.step("Exporting APK", 0)) {
+ if (ep.step("Exporting APK...", 0)) {
device_lock->unlock();
return ERR_SKIP;
}
const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
- const bool use_reverse = devices[p_device].api_level >= 21 && devices[p_device].usb;
- // Note: Reverse can still fail if device is connected by both usb and network
- // Ideally we'd know for sure whether adb reverse would work before we build the APK
+ const bool use_reverse = devices[p_device].api_level >= 21;
if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
@@ -1560,7 +1544,7 @@ public:
}
print_line("Installing to device (please wait...): " + devices[p_device].name);
- if (ep.step("Installing to device (please wait...)", 2)) {
+ if (ep.step("Installing to device, please wait...", 2)) {
CLEANUP_AND_RETURN(ERR_SKIP);
}
@@ -1621,13 +1605,13 @@ public:
}
} else {
- static const char *const msg = "--- Device API < 21 or no USB connection; debugging over Wi-Fi ---";
+ static const char *const msg = "--- Device API < 21; debugging over Wi-Fi ---";
EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR);
print_line(String(msg).to_upper());
}
}
- if (ep.step("Running on Device...", 3)) {
+ if (ep.step("Running on device...", 3)) {
CLEANUP_AND_RETURN(ERR_SKIP);
}
args.clear();
@@ -1891,7 +1875,7 @@ public:
new_file += "//CHUNK_" + text + "_BEGIN\n";
if (!found) {
- ERR_PRINTS("No end marker found in build.gradle for chunk: " + text);
+ ERR_PRINT("No end marker found in build.gradle for chunk: " + text);
f->seek(pos);
} else {
@@ -1927,7 +1911,7 @@ public:
new_file += "//DIR_" + text + "_BEGIN\n";
if (!found) {
- ERR_PRINTS("No end marker found in build.gradle for dir: " + text);
+ ERR_PRINT("No end marker found in build.gradle for dir: " + text);
f->seek(pos);
} else {
//add chunk lines
@@ -1986,7 +1970,7 @@ public:
new_file += "<!--CHUNK_" + text + "_BEGIN-->\n";
if (!found) {
- ERR_PRINTS("No end marker found in AndroidManifest.xml for chunk: " + text);
+ ERR_PRINT("No end marker found in AndroidManifest.xml for chunk: " + text);
f->seek(pos);
} else {
//add chunk lines
@@ -2005,7 +1989,7 @@ public:
String last_tag = "android:icon=\"@mipmap/icon\"";
int last_tag_pos = l.find(last_tag);
if (last_tag_pos == -1) {
- ERR_PRINTS("Not adding application attributes as the expected tag was not found in '<application': " + last_tag);
+ ERR_PRINT("Not adding application attributes as the expected tag was not found in '<application': " + last_tag);
new_file += l + "\n";
} else {
String base = l.substr(0, last_tag_pos + last_tag.length());
@@ -2132,7 +2116,7 @@ public:
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- if (ep.step("Creating APK", 0)) {
+ if (ep.step("Creating APK...", 0)) {
return ERR_SKIP;
}
@@ -2294,7 +2278,7 @@ public:
ret = unzGoToNextFile(pkg);
}
- if (ep.step("Adding Files...", 1)) {
+ if (ep.step("Adding files...", 1)) {
CLEANUP_AND_RETURN(ERR_SKIP);
}
Error err = OK;
diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle
index 258ca9197a..2e4f2ffab0 100644
--- a/platform/android/java/app/build.gradle
+++ b/platform/android/java/app/build.gradle
@@ -33,6 +33,8 @@ allprojects {
}
dependencies {
+ implementation libraries.supportCoreUtils
+
if (rootProject.findProject(":lib")) {
implementation project(":lib")
} else {
diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle
index 862a954fac..5550d3099d 100644
--- a/platform/android/java/app/config.gradle
+++ b/platform/android/java/app/config.gradle
@@ -4,11 +4,13 @@ ext.versions = [
minSdk : 18,
targetSdk : 28,
buildTools : '28.0.3',
+ supportCoreUtils : '28.0.0'
]
ext.libraries = [
- androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin"
+ androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin",
+ supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils"
]
ext.getExportPackageName = { ->
diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle
index 13a14422ed..eb97484b9c 100644
--- a/platform/android/java/lib/build.gradle
+++ b/platform/android/java/lib/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
- implementation "com.android.support:support-core-utils:28.0.0"
+ implementation libraries.supportCoreUtils
}
def pathToRootDir = "../../../../"
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
index 44998aa6c0..e901b4b36d 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
@@ -123,7 +123,7 @@ public class GodotEditText extends EditText {
}
private void setMaxInputLength(EditText p_edit_text, int p_max_input_length) {
- if (p_max_input_length >= 0) {
+ if (p_max_input_length > 0) {
InputFilter[] filters = new InputFilter[1];
filters[0] = new InputFilter.LengthFilter(p_max_input_length);
p_edit_text.setFilters(filters);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 44c5b5d6b4..e5d9bdc60c 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -507,9 +507,8 @@ void OS_Android::process_double_tap(Point2 p_pos) {
ev.instance();
ev->set_position(p_pos);
ev->set_global_position(p_pos);
- ev->set_pressed(true);
+ ev->set_pressed(false);
ev->set_doubleclick(true);
- ev->set_button_index(1);
input->parse_input_event(ev);
}
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index b606d570c2..104f9e751e 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -1030,7 +1030,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
print_line("Creating " + dir_name);
Error dir_err = tmp_app_path->make_dir_recursive(dir_name);
if (dir_err) {
- ERR_PRINTS("Can't create '" + dir_name + "'.");
+ ERR_PRINT("Can't create '" + dir_name + "'.");
unzClose(src_pkg_zip);
memdelete(tmp_app_path);
return ERR_CANT_CREATE;
@@ -1040,7 +1040,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
/* write the file */
FileAccess *f = FileAccess::open(file, FileAccess::WRITE);
if (!f) {
- ERR_PRINTS("Can't write '" + file + "'.");
+ ERR_PRINT("Can't write '" + file + "'.");
unzClose(src_pkg_zip);
memdelete(tmp_app_path);
return ERR_CANT_CREATE;
@@ -1064,7 +1064,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
unzClose(src_pkg_zip);
if (!found_library) {
- ERR_PRINTS("Requested template library '" + library_to_use + "' not found. It might be missing from your template archive.");
+ ERR_PRINT("Requested template library '" + library_to_use + "' not found. It might be missing from your template archive.");
memdelete(tmp_app_path);
return ERR_FILE_NOT_FOUND;
}
@@ -1093,7 +1093,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
String project_file_name = dest_dir + binary_name + ".xcodeproj/project.pbxproj";
FileAccess *f = FileAccess::open(project_file_name, FileAccess::WRITE);
if (!f) {
- ERR_PRINTS("Can't write '" + project_file_name + "'.");
+ ERR_PRINT("Can't write '" + project_file_name + "'.");
return ERR_CANT_CREATE;
};
f->store_buffer(project_file_data.ptr(), project_file_data.size());
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 7bf3e1bc1d..1766833364 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -131,6 +131,11 @@ def configure(env):
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+ # Only include the JavaScript support code for the web environment
+ # (i.e. exclude Node.js and other unused environments).
+ # This makes the JavaScript support code about 4 KB smaller.
+ env.Append(LINKFLAGS=['-s', 'ENVIRONMENT=web'])
+
# This needs to be defined for Emscripten using 'fastcomp' (default pre-1.39.0)
# and undefined if using 'upstream'. And to make things simple, earlier
# Emscripten versions didn't include 'fastcomp' in their path, so we check
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 9b93d4f140..c1cb8bcb58 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -86,7 +86,7 @@ public:
ERR_FAIL_COND_MSG(req[0] != "GET" || req[2] != "HTTP/1.1", "Invalid method or HTTP version.");
String filepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
- String basereq = "/tmp_js_export";
+ const String basereq = "/tmp_js_export";
String ctype = "";
if (req[1] == basereq + ".html") {
filepath += ".html";
@@ -97,8 +97,13 @@ public:
} else if (req[1] == basereq + ".pck") {
filepath += ".pck";
ctype = "application/octet-stream";
- } else if (req[1] == basereq + ".png") {
- filepath += ".png";
+ } else if (req[1] == basereq + ".png" || req[1] == "/favicon.png") {
+ // Also allow serving the generated favicon for a smoother loading experience.
+ if (req[1] == "/favicon.png") {
+ filepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("favicon.png");
+ } else {
+ filepath += ".png";
+ }
ctype = "image/png";
} else if (req[1] == basereq + ".wasm") {
filepath += ".wasm";
@@ -470,11 +475,10 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
Ref<Image> splash;
- String splash_path = GLOBAL_GET("application/boot_splash/image");
- splash_path = splash_path.strip_edges();
+ const String splash_path = String(GLOBAL_GET("application/boot_splash/image")).strip_edges();
if (!splash_path.empty()) {
splash.instance();
- Error err = splash->load(splash_path);
+ const Error err = splash->load(splash_path);
if (err) {
EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image."));
splash.unref();
@@ -483,11 +487,32 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
if (splash.is_null()) {
splash = Ref<Image>(memnew(Image(boot_splash_png)));
}
- String png_path = p_path.get_base_dir().plus_file(p_path.get_file().get_basename() + ".png");
- if (splash->save_png(png_path) != OK) {
- EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + png_path);
+ const String splash_png_path = p_path.get_base_dir().plus_file(p_path.get_file().get_basename() + ".png");
+ if (splash->save_png(splash_png_path) != OK) {
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + splash_png_path);
return ERR_FILE_CANT_WRITE;
}
+
+ // Save a favicon that can be accessed without waiting for the project to finish loading.
+ // This way, the favicon can be displayed immediately when loading the page.
+ Ref<Image> favicon;
+ const String favicon_path = String(GLOBAL_GET("application/config/icon")).strip_edges();
+ if (!favicon_path.empty()) {
+ favicon.instance();
+ const Error err = favicon->load(favicon_path);
+ if (err) {
+ favicon.unref();
+ }
+ }
+
+ if (favicon.is_valid()) {
+ const String favicon_png_path = p_path.get_base_dir().plus_file("favicon.png");
+ if (favicon->save_png(favicon_png_path) != OK) {
+ EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + favicon_png_path);
+ return ERR_FILE_CANT_WRITE;
+ }
+ }
+
return OK;
}
@@ -536,9 +561,8 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
return OK;
}
- String basepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
- String path = basepath + ".html";
- Error err = export_project(p_preset, true, path, p_debug_flags);
+ const String basepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
+ Error err = export_project(p_preset, true, basepath + ".html", p_debug_flags);
if (err != OK) {
// Export generates several files, clean them up on failure.
DirAccess::remove_file_or_error(basepath + ".html");
@@ -546,13 +570,14 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
DirAccess::remove_file_or_error(basepath + ".pck");
DirAccess::remove_file_or_error(basepath + ".png");
DirAccess::remove_file_or_error(basepath + ".wasm");
+ DirAccess::remove_file_or_error(EditorSettings::get_singleton()->get_cache_dir().plus_file("favicon.png"));
return err;
}
- IP_Address bind_ip;
- uint16_t bind_port = EDITOR_GET("export/web/http_port");
+ const uint16_t bind_port = EDITOR_GET("export/web/http_port");
// Resolve host if needed.
- String bind_host = EDITOR_GET("export/web/http_host");
+ const String bind_host = EDITOR_GET("export/web/http_host");
+ IP_Address bind_ip;
if (bind_host.is_valid_ip_address()) {
bind_ip = bind_host;
} else {
diff --git a/platform/javascript/http_request.js b/platform/javascript/http_request.js
index c112039d0b..f621689f9d 100644
--- a/platform/javascript/http_request.js
+++ b/platform/javascript/http_request.js
@@ -3,9 +3,10 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/javascript/id_handler.js b/platform/javascript/id_handler.js
index 36ef5aa8ef..3851123ed1 100644
--- a/platform/javascript/id_handler.js
+++ b/platform/javascript/id_handler.js
@@ -3,9 +3,10 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 632a7df9e8..34dce90b6b 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -980,7 +980,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
EMSCRIPTEN_RESULT result;
#define EM_CHECK(ev) \
if (result != EMSCRIPTEN_RESULT_SUCCESS) \
- ERR_PRINTS("Error while setting " #ev " callback: Code " + itos(result))
+ ERR_PRINT("Error while setting " #ev " callback: Code " + itos(result));
#define SET_EM_CALLBACK(target, ev, cb) \
result = emscripten_set_##ev##_callback(target, NULL, true, &cb); \
EM_CHECK(ev)
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 7882253e7a..fe839199e8 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -27,6 +27,9 @@ def get_opts():
('MACOS_SDK_PATH', 'Path to the macOS SDK', ''),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
+ BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
+ BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
+ BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
]
@@ -122,6 +125,21 @@ def configure(env):
env["CC"] = "clang"
env["LINK"] = "clang++"
+ if env['use_ubsan'] or env['use_asan'] or env['use_tsan']:
+ env.extra_suffix += "s"
+
+ if env['use_ubsan']:
+ env.Append(CCFLAGS=['-fsanitize=undefined'])
+ env.Append(LINKFLAGS=['-fsanitize=undefined'])
+
+ if env['use_asan']:
+ env.Append(CCFLAGS=['-fsanitize=address'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+
+ if env['use_tsan']:
+ env.Append(CCFLAGS=['-fsanitize=thread'])
+ env.Append(LINKFLAGS=['-fsanitize=thread'])
+
## Dependencies
if env['builtin_libtheora']:
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index cf38664022..f372093268 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -692,7 +692,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
unzClose(src_pkg_zip);
if (!found_binary) {
- ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive.");
+ ERR_PRINT("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive.");
err = ERR_FILE_NOT_FOUND;
}
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6a214b8669..bc77ac3cfd 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -115,6 +115,20 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
return Vector2(mouse_x, mouse_y);
}
+static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) {
+ if ([NSCursor respondsToSelector:selector]) {
+ id object = [NSCursor performSelector:selector];
+ if ([object isKindOfClass:[NSCursor class]]) {
+ return object;
+ }
+ }
+ if (fallback) {
+ // Fallback should be a reasonable default, no need to check.
+ return [NSCursor performSelector:fallback];
+ }
+ return [NSCursor arrowCursor];
+}
+
@interface GodotApplication : NSApplication
@end
@@ -1813,15 +1827,15 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
- case CURSOR_FORBIDDEN: [[NSCursor arrowCursor] set]; break;
- case CURSOR_VSIZE: [[NSCursor resizeUpDownCursor] set]; break;
- case CURSOR_HSIZE: [[NSCursor resizeLeftRightCursor] set]; break;
- case CURSOR_BDIAGSIZE: [[NSCursor arrowCursor] set]; break;
- case CURSOR_FDIAGSIZE: [[NSCursor arrowCursor] set]; break;
+ case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break;
+ case CURSOR_VSIZE: [cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break;
+ case CURSOR_HSIZE: [cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break;
+ case CURSOR_BDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break;
+ case CURSOR_FDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break;
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] set]; break;
- case CURSOR_HELP: [[NSCursor arrowCursor] set]; break;
+ case CURSOR_HELP: [cursorFromSelector(@selector(_helpCursor)) set]; break;
default: {
};
}
@@ -2917,7 +2931,7 @@ void OS_OSX::run() {
quit = true;
}
} @catch (NSException *exception) {
- ERR_PRINTS("NSException: " + String([exception reason].UTF8String));
+ ERR_PRINT("NSException: " + String([exception reason].UTF8String));
}
};
@@ -2973,7 +2987,7 @@ Error OS_OSX::move_to_trash(const String &p_path) {
NSError *err;
if (![fm trashItemAtURL:url resultingItemURL:nil error:&err]) {
- ERR_PRINTS("trashItemAtURL error: " + String(err.localizedDescription.UTF8String));
+ ERR_PRINT("trashItemAtURL error: " + String(err.localizedDescription.UTF8String));
return FAILED;
}
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 57fb9004b8..96a196c65d 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1176,7 +1176,7 @@ public:
err += TTR("Invalid square 71x71 logo image dimensions (should be 71x71).") + "\n";
}
- if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 0)) {
+ if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 150)) {
valid = false;
err += TTR("Invalid square 150x150 logo image dimensions (should be 150x150).") + "\n";
}
@@ -1397,7 +1397,7 @@ public:
}
if (!FileAccess::exists(signtool_path)) {
- ERR_PRINTS("Could not find signtool executable at " + signtool_path + ", aborting.");
+ ERR_PRINT("Could not find signtool executable at " + signtool_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
@@ -1418,12 +1418,12 @@ public:
}
if (!FileAccess::exists(cert_path)) {
- ERR_PRINTS("Could not find certificate file at " + cert_path + ", aborting.");
+ ERR_PRINT("Could not find certificate file at " + cert_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
if (cert_alg < 0 || cert_alg > 2) {
- ERR_PRINTS("Invalid certificate algorithm " + itos(cert_alg) + ", aborting.");
+ ERR_PRINT("Invalid certificate algorithm " + itos(cert_alg) + ", aborting.");
return ERR_INVALID_DATA;
}
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 500736bd3f..72c3f60d99 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -293,12 +293,7 @@ def configure_mingw(env):
## Compiler configuration
- if (os.name == "nt"):
- # Force splitting libmodules.a in multiple chunks to work around
- # issues reaching the linker command line size limit, which also
- # seem to induce huge slowdown for 'ar' (GH-30892).
- env['split_libmodules'] = True
- else:
+ if os.name != "nt":
env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
if (env["bits"] == "default"):
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 34d66ecd79..31501c2cd3 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -105,7 +105,7 @@ void EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset>
}
if (!FileAccess::exists(rcedit_path)) {
- ERR_PRINTS("Could not find rcedit executable at " + rcedit_path + ", no icon or app information data will be included.");
+ ERR_PRINT("Could not find rcedit executable at " + rcedit_path + ", no icon or app information data will be included.");
return;
}
@@ -114,7 +114,7 @@ void EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset>
String wine_path = EditorSettings::get_singleton()->get("export/windows/wine");
if (wine_path != String() && !FileAccess::exists(wine_path)) {
- ERR_PRINTS("Could not find wine executable at " + wine_path + ", no icon or app information data will be included.");
+ ERR_PRINT("Could not find wine executable at " + wine_path + ", no icon or app information data will be included.");
return;
}
@@ -188,7 +188,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
#ifdef WINDOWS_ENABLED
String signtool_path = EditorSettings::get_singleton()->get("export/windows/signtool");
if (signtool_path != String() && !FileAccess::exists(signtool_path)) {
- ERR_PRINTS("Could not find signtool executable at " + signtool_path + ", aborting.");
+ ERR_PRINT("Could not find signtool executable at " + signtool_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
if (signtool_path == String()) {
@@ -197,7 +197,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
#else
String signtool_path = EditorSettings::get_singleton()->get("export/windows/osslsigncode");
if (signtool_path != String() && !FileAccess::exists(signtool_path)) {
- ERR_PRINTS("Could not find osslsigncode executable at " + signtool_path + ", aborting.");
+ ERR_PRINT("Could not find osslsigncode executable at " + signtool_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
if (signtool_path == String()) {
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index a6977a7a86..2daaf9359a 100755
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2854,7 +2854,7 @@ void OS_Windows::set_native_icon(const String &p_filename) {
ERR_FAIL_COND_MSG(big_icon_index == -1, "No valid icons found!");
if (small_icon_index == -1) {
- WARN_PRINTS("No small icon found, reusing " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon!");
+ WARN_PRINT("No small icon found, reusing " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon!");
small_icon_index = big_icon_index;
small_icon_cc = big_icon_cc;
}
@@ -3363,7 +3363,7 @@ Error OS_Windows::move_to_trash(const String &p_path) {
delete[] from;
if (ret) {
- ERR_PRINTS("SHFileOperation error: " + itos(ret));
+ ERR_PRINT("SHFileOperation error: " + itos(ret));
return FAILED;
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 57c7b0594c..55a612eb37 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1429,11 +1429,15 @@ void OS_X11::set_window_fullscreen(bool p_enabled) {
set_window_maximized(true);
}
set_wm_fullscreen(p_enabled);
- if (!p_enabled && !current_videomode.always_on_top) {
+ if (!p_enabled && current_videomode.always_on_top) {
// Restore
set_window_maximized(false);
}
-
+ if (!p_enabled) {
+ set_window_position(last_position_before_fs);
+ } else {
+ last_position_before_fs = get_window_position();
+ }
current_videomode.fullscreen = p_enabled;
}
@@ -3402,7 +3406,7 @@ Error OS_X11::move_to_trash(const String &p_path) {
// Issue an error if none of the previous locations is appropriate for the trash can.
if (trash_can == "") {
- ERR_PRINTS("move_to_trash: Could not determine the trash can location");
+ ERR_PRINT("move_to_trash: Could not determine the trash can location");
return FAILED;
}
@@ -3413,7 +3417,7 @@ Error OS_X11::move_to_trash(const String &p_path) {
// Issue an error if trash can is not created proprely.
if (err != OK) {
- ERR_PRINTS("move_to_trash: Could not create the trash can \"" + trash_can + "\"");
+ ERR_PRINT("move_to_trash: Could not create the trash can \"" + trash_can + "\"");
return err;
}
@@ -3427,7 +3431,7 @@ Error OS_X11::move_to_trash(const String &p_path) {
// Issue an error if "mv" failed to move the given resource to the trash can.
if (err != OK || retval != 0) {
- ERR_PRINTS("move_to_trash: Could not move the resource \"" + p_path + "\" to the trash can \"" + trash_can + "\"");
+ ERR_PRINT("move_to_trash: Could not move the resource \"" + p_path + "\" to the trash can \"" + trash_can + "\"");
return FAILED;
}
@@ -3502,4 +3506,5 @@ OS_X11::OS_X11() {
window_focused = true;
xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE;
+ last_position_before_fs = Vector2();
}
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 01e5aac3df..25b406743b 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -115,6 +115,7 @@ class OS_X11 : public OS_Unix {
// IME
bool im_active;
Vector2 im_position;
+ Vector2 last_position_before_fs;
Size2 min_size;
Size2 max_size;