summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml4
-rw-r--r--platform/linuxbsd/export/export_plugin.cpp6
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp45
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp9
-rw-r--r--platform/linuxbsd/x11/display_server_x11.h1
5 files changed, 46 insertions, 19 deletions
diff --git a/platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml b/platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml
index 4ab2464929..77a6ece756 100644
--- a/platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml
+++ b/platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml
@@ -23,8 +23,8 @@
<member name="custom_template/release" type="String" setter="" getter="">
Path to the custom export template. If left empty, default template is used.
</member>
- <member name="debug/export_console_script" type="int" setter="" getter="">
- If [code]true[/code], a console wrapper script is exported alongside the main executable, which allows running the project with enabled console output.
+ <member name="debug/export_console_wrapper" type="int" setter="" getter="">
+ If [code]true[/code], a console wrapper is exported alongside the main executable, which allows running the project with enabled console output.
</member>
<member name="ssh_remote_deploy/cleanup_script" type="String" setter="" getter="">
Script code to execute on the remote host when app is finished.
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index daa2664b09..082040c8d6 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -95,15 +95,15 @@ Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset>
return err;
}
- // Save console script.
+ // Save console wrapper.
if (err == OK) {
- int con_scr = p_preset->get("debug/export_console_script");
+ int con_scr = p_preset->get("debug/export_console_wrapper");
if ((con_scr == 1 && p_debug) || (con_scr == 2)) {
String scr_path = path.get_basename() + ".sh";
err = _export_debug_script(p_preset, pkg_name, path.get_file(), scr_path);
FileAccess::set_unix_permissions(scr_path, 0755);
if (err != OK) {
- add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Script Export"), TTR("Could not create console script."));
+ add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Console Export"), TTR("Could not create console wrapper."));
}
}
}
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index ebdbd061d1..310778388b 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -496,11 +496,19 @@ bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) {
return font_config_initialized;
}
#endif
+
+#ifndef __linux__
+ // `bsd` includes **all** BSD, not only "other BSD" (see `get_name()`).
+ if (p_feature == "bsd") {
+ return true;
+ }
+#endif
+
if (p_feature == "pc") {
return true;
}
- // Match against the specific OS (linux, freebsd, etc).
+ // Match against the specific OS (`linux`, `freebsd`, `netbsd`, `openbsd`).
if (p_feature == get_name().to_lower()) {
return true;
}
@@ -953,32 +961,41 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
args.push_back(path);
args.push_front("trash"); // The command is `gio trash <file_name>` so we need to add it to args.
Error result = execute("gio", args, nullptr, &err_code); // For GNOME based machines.
- if (result == OK && !err_code) {
- return OK;
- } else if (err_code == 2) {
- return ERR_FILE_NOT_FOUND;
+ if (result == OK) { // The `execute` function has done its job without errors.
+ if (!err_code) { // The shell command has been executed without errors.
+ return OK;
+ } else if (err_code == 1) {
+ ERR_PRINT("move_to_trash: No such file or directory as " + path + ".");
+ return ERR_FILE_NOT_FOUND;
+ }
}
args.pop_front();
args.push_front("move");
args.push_back("trash:/"); // The command is `kioclient5 move <file_name> trash:/`.
result = execute("kioclient5", args, nullptr, &err_code); // For KDE based machines.
- if (result == OK && !err_code) {
- return OK;
- } else if (err_code == 2) {
- return ERR_FILE_NOT_FOUND;
+ if (result == OK) { // The `execute` function has done its job without errors.
+ if (!err_code) { // The shell command has been executed without errors.
+ return OK;
+ } else if (err_code == 1) {
+ ERR_PRINT("move_to_trash: No such file or directory as " + path + ".");
+ return ERR_FILE_NOT_FOUND;
+ }
}
args.pop_front();
args.pop_back();
result = execute("gvfs-trash", args, nullptr, &err_code); // For older Linux machines.
- if (result == OK && !err_code) {
- return OK;
- } else if (err_code == 2) {
- return ERR_FILE_NOT_FOUND;
+ if (result == OK) { // The `execute` function has done its job without errors.
+ if (!err_code) { // The shell command has been executed without errors.
+ return OK;
+ } else if (err_code == 1) {
+ ERR_PRINT("move_to_trash: No such file or directory as " + path + ".");
+ return ERR_FILE_NOT_FOUND;
+ }
}
- // If the commands `kioclient5`, `gio` or `gvfs-trash` don't exist on the system we do it manually.
+ // If the commands `kioclient5`, `gio` or `gvfs-trash` don't work on the system we do it manually.
String trash_path = "";
String mnt = get_mountpoint(path);
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 83b6fb7628..a607e26ac5 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2626,6 +2626,15 @@ void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
XFlush(x11_display);
}
+bool DisplayServerX11::window_is_focused(WindowID p_window) const {
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_COND_V(!windows.has(p_window), false);
+ const WindowData &wd = windows[p_window];
+
+ return wd.focused;
+}
+
bool DisplayServerX11::window_can_draw(WindowID p_window) const {
//this seems to be all that is provided by X11
return window_get_mode(p_window) != WINDOW_MODE_MINIMIZED;
diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h
index 176a1ffb9a..180362923b 100644
--- a/platform/linuxbsd/x11/display_server_x11.h
+++ b/platform/linuxbsd/x11/display_server_x11.h
@@ -477,6 +477,7 @@ public:
virtual void window_request_attention(WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) override;
+ virtual bool window_is_focused(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const override;