summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/detect.py21
-rw-r--r--platform/linuxbsd/export/export_plugin.cpp18
-rw-r--r--platform/linuxbsd/freedesktop_portal_desktop.cpp2
-rw-r--r--platform/linuxbsd/x11/detect_prime_x11.cpp14
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp34
-rw-r--r--platform/linuxbsd/x11/gl_manager_x11.cpp9
-rw-r--r--platform/linuxbsd/x11/gl_manager_x11.h1
7 files changed, 63 insertions, 36 deletions
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 72bffceb1f..59cc6e7962 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -85,6 +85,16 @@ def configure(env: "Environment"):
# gdb works fine without it though, so maybe our crash handler could too.
env.Append(LINKFLAGS=["-rdynamic"])
+ # Cross-compilation
+ # TODO: Support cross-compilation on architectures other than x86.
+ host_is_64_bit = sys.maxsize > 2**32
+ if host_is_64_bit and env["arch"] == "x86_32":
+ env.Append(CCFLAGS=["-m32"])
+ env.Append(LINKFLAGS=["-m32"])
+ elif not host_is_64_bit and env["arch"] == "x86_64":
+ env.Append(CCFLAGS=["-m64"])
+ env.Append(LINKFLAGS=["-m64"])
+
# CPU architecture flags.
if env["arch"] == "rv64":
# G = General-purpose extensions, C = Compression extension (very common).
@@ -469,22 +479,11 @@ def configure(env: "Environment"):
if platform.system() == "FreeBSD":
env.Append(LINKFLAGS=["-lkvm"])
- ## Cross-compilation
- # TODO: Support cross-compilation on architectures other than x86.
- host_is_64_bit = sys.maxsize > 2**32
- if host_is_64_bit and env["arch"] == "x86_32":
- env.Append(CCFLAGS=["-m32"])
- env.Append(LINKFLAGS=["-m32", "-L/usr/lib/i386-linux-gnu"])
- elif not host_is_64_bit and env["arch"] == "x86_64":
- env.Append(CCFLAGS=["-m64"])
- env.Append(LINKFLAGS=["-m64", "-L/usr/lib/i686-linux-gnu"])
-
# Link those statically for portability
if env["use_static_cpp"]:
env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
if env["use_llvm"] and platform.system() != "FreeBSD":
env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a"
-
else:
if env["use_llvm"] and platform.system() != "FreeBSD":
env.Append(LIBS=["atomic"])
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index 9d1e058b76..64efcffae3 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -79,6 +79,7 @@ Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset>
Ref<DirAccess> tmp_app_dir = DirAccess::create_for_path(tmp_dir_path);
if (export_as_zip) {
if (tmp_app_dir.is_null()) {
+ add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Templates"), vformat(TTR("Could not create and open the directory: \"%s\""), tmp_dir_path));
return ERR_CANT_CREATE;
}
if (DirAccess::exists(tmp_dir_path)) {
@@ -93,19 +94,18 @@ Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset>
// Export project.
Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, path, p_flags);
if (err != OK) {
+ // Message is supplied by the subroutine method.
return err;
}
// Save console wrapper.
- if (err == OK) {
- 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 Console Export"), TTR("Could not create console wrapper."));
- }
+ 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 Console Export"), TTR("Could not create console wrapper."));
}
}
diff --git a/platform/linuxbsd/freedesktop_portal_desktop.cpp b/platform/linuxbsd/freedesktop_portal_desktop.cpp
index d9aa98ba70..6a5b5b8064 100644
--- a/platform/linuxbsd/freedesktop_portal_desktop.cpp
+++ b/platform/linuxbsd/freedesktop_portal_desktop.cpp
@@ -434,7 +434,7 @@ void FreeDesktopPortalDesktop::_file_dialog_callback(const Callable &p_callable,
p_callable.callp(args, 3, ret, ce);
if (ce.error != Callable::CallError::CALL_OK) {
- ERR_PRINT(vformat(RTR("Failed to execute file dialogs callback: %s."), Variant::get_callable_error_text(p_callable, args, 3, ce)));
+ ERR_PRINT(vformat("Failed to execute file dialogs callback: %s.", Variant::get_callable_error_text(p_callable, args, 3, ce)));
}
}
diff --git a/platform/linuxbsd/x11/detect_prime_x11.cpp b/platform/linuxbsd/x11/detect_prime_x11.cpp
index 2b5776ce54..c2cb02b937 100644
--- a/platform/linuxbsd/x11/detect_prime_x11.cpp
+++ b/platform/linuxbsd/x11/detect_prime_x11.cpp
@@ -137,6 +137,19 @@ void create_context() {
XFree(vi);
}
+int silent_error_handler(Display *display, XErrorEvent *error) {
+ static char message[1024];
+ XGetErrorText(display, error->error_code, message, sizeof(message));
+ print_verbose(vformat("XServer error: %s"
+ "\n Major opcode of failed request: %d"
+ "\n Serial number of failed request: %d"
+ "\n Current serial number in output stream: %d",
+ String::utf8(message), (uint64_t)error->request_code, (uint64_t)error->minor_code, (uint64_t)error->serial));
+
+ quick_exit(1);
+ return 0;
+}
+
int detect_prime() {
pid_t p;
int priorities[2] = {};
@@ -189,6 +202,7 @@ int detect_prime() {
// cleaning up these processes, and fork() makes a copy
// of all globals.
CoreGlobals::leak_reporting_enabled = false;
+ XSetErrorHandler(&silent_error_handler);
char string[201];
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 55c637fc93..bbb4b04508 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -3875,7 +3875,7 @@ void DisplayServerX11::_xim_preedit_draw_callback(::XIM xim, ::XPointer client_d
ds->im_selection = Point2i();
}
- OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
+ OS_Unix::get_singleton()->get_main_loop()->call_deferred(SNAME("notification"), MainLoop::NOTIFICATION_OS_IME_UPDATE);
}
}
@@ -6065,33 +6065,36 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
}
if (rendering_driver == "opengl3") {
- GLManager_X11::ContextType opengl_api_type = GLManager_X11::GLES_3_0_COMPATIBLE;
-
- gl_manager = memnew(GLManager_X11(p_resolution, opengl_api_type));
-
- if (gl_manager->initialize(x11_display) != OK) {
+ gl_manager = memnew(GLManager_X11(p_resolution, GLManager_X11::GLES_3_0_COMPATIBLE));
+ if (gl_manager->initialize(x11_display) != OK || gl_manager->open_display(x11_display) != OK) {
memdelete(gl_manager);
gl_manager = nullptr;
- r_error = ERR_UNAVAILABLE;
- return;
+ bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_gles");
+ if (fallback) {
+ WARN_PRINT("Your video card drivers seem not to support the required OpenGL version, switching to OpenGLES.");
+ rendering_driver = "opengl3_es";
+ } else {
+ r_error = ERR_UNAVAILABLE;
+ ERR_FAIL_MSG("Could not initialize OpenGL.");
+ }
+ } else {
+ driver_found = true;
+ RasterizerGLES3::make_current(true);
}
- driver_found = true;
-
- RasterizerGLES3::make_current(true);
}
+
if (rendering_driver == "opengl3_es") {
gl_manager_egl = memnew(GLManagerEGL_X11);
-
if (gl_manager_egl->initialize() != OK) {
memdelete(gl_manager_egl);
gl_manager_egl = nullptr;
r_error = ERR_UNAVAILABLE;
- return;
+ ERR_FAIL_MSG("Could not initialize OpenGLES.");
}
driver_found = true;
-
RasterizerGLES3::make_current(false);
}
+
#endif
if (!driver_found) {
r_error = ERR_UNAVAILABLE;
@@ -6105,7 +6108,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (p_screen == SCREEN_OF_MAIN_WINDOW) {
p_screen = SCREEN_PRIMARY;
}
- window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2;
+ Rect2i scr_rect = screen_get_usable_rect(p_screen);
+ window_position = scr_rect.position + (scr_rect.size - p_resolution) / 2;
}
WindowID main_window = _create_window(p_mode, p_vsync_mode, p_flags, Rect2i(window_position, p_resolution));
diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp
index 95947301cf..602dd784e0 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.cpp
+++ b/platform/linuxbsd/x11/gl_manager_x11.cpp
@@ -208,6 +208,15 @@ XVisualInfo GLManager_X11::get_vi(Display *p_display, Error &r_error) {
return _displays[display_id].x_vi;
}
+Error GLManager_X11::open_display(Display *p_display) {
+ int gldisplay_id = _find_or_create_display(p_display);
+ if (gldisplay_id < 0) {
+ return ERR_CANT_CREATE;
+ } else {
+ return OK;
+ }
+}
+
Error GLManager_X11::window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height) {
// make sure vector is big enough...
// we can mirror the external vector, it is simpler
diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h
index d3a25506a8..235c7d22f9 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.h
+++ b/platform/linuxbsd/x11/gl_manager_x11.h
@@ -129,6 +129,7 @@ public:
void *get_glx_context(DisplayServer::WindowID p_window_id);
+ Error open_display(Display *p_display);
GLManager_X11(const Vector2i &p_size, ContextType p_context_type);
~GLManager_X11();
};