diff options
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml | 4 | ||||
-rw-r--r-- | platform/linuxbsd/export/export.cpp | 3 | ||||
-rw-r--r-- | platform/linuxbsd/export/export_plugin.cpp | 11 | ||||
-rw-r--r-- | platform/linuxbsd/freedesktop_portal_desktop.cpp | 3 | ||||
-rw-r--r-- | platform/linuxbsd/godot_linuxbsd.cpp | 7 | ||||
-rw-r--r-- | platform/linuxbsd/joypad_linux.cpp | 2 | ||||
-rw-r--r-- | platform/linuxbsd/joypad_linux.h | 1 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 67 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.h | 5 | ||||
-rw-r--r-- | platform/linuxbsd/tts_linux.cpp | 57 | ||||
-rw-r--r-- | platform/linuxbsd/tts_linux.h | 8 | ||||
-rw-r--r-- | platform/linuxbsd/x11/detect_prime_x11.cpp | 14 | ||||
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 34 | ||||
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.h | 33 | ||||
-rw-r--r-- | platform/linuxbsd/x11/gl_manager_x11.cpp | 10 | ||||
-rw-r--r-- | platform/linuxbsd/x11/gl_manager_x11.h | 10 | ||||
-rw-r--r-- | platform/linuxbsd/x11/key_mapping_x11.h | 7 | ||||
-rw-r--r-- | platform/linuxbsd/x11/vulkan_context_x11.h | 1 |
18 files changed, 159 insertions, 118 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.cpp b/platform/linuxbsd/export/export.cpp index 09f354246d..f72c079d1d 100644 --- a/platform/linuxbsd/export/export.cpp +++ b/platform/linuxbsd/export/export.cpp @@ -30,9 +30,10 @@ #include "export.h" -#include "editor/export/editor_export.h" #include "export_plugin.h" +#include "editor/export/editor_export.h" + void register_linuxbsd_exporter_types() { GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformLinuxBSD); } diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp index 9544cc761d..082040c8d6 100644 --- a/platform/linuxbsd/export/export_plugin.cpp +++ b/platform/linuxbsd/export/export_plugin.cpp @@ -30,13 +30,14 @@ #include "export_plugin.h" +#include "../logo_svg.gen.h" +#include "../run_icon_svg.gen.h" + #include "core/config/project_settings.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_scale.h" #include "editor/export/editor_export.h" -#include "platform/linuxbsd/logo_svg.gen.h" -#include "platform/linuxbsd/run_icon_svg.gen.h" #include "modules/modules_enabled.gen.h" // For svg. #ifdef MODULE_SVG_ENABLED @@ -94,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/freedesktop_portal_desktop.cpp b/platform/linuxbsd/freedesktop_portal_desktop.cpp index 6dfa8ed93c..c3cb0f411d 100644 --- a/platform/linuxbsd/freedesktop_portal_desktop.cpp +++ b/platform/linuxbsd/freedesktop_portal_desktop.cpp @@ -35,6 +35,7 @@ #include "core/error/error_macros.h" #include "core/os/os.h" #include "core/string/ustring.h" +#include "core/variant/variant.h" #ifdef SOWRAP_ENABLED #include "dbus-so_wrap.h" @@ -42,8 +43,6 @@ #include <dbus/dbus.h> #endif -#include "core/variant/variant.h" - #define BUS_OBJECT_NAME "org.freedesktop.portal.Desktop" #define BUS_OBJECT_PATH "/org/freedesktop/portal/desktop" diff --git a/platform/linuxbsd/godot_linuxbsd.cpp b/platform/linuxbsd/godot_linuxbsd.cpp index 76d579dd53..d059d60b72 100644 --- a/platform/linuxbsd/godot_linuxbsd.cpp +++ b/platform/linuxbsd/godot_linuxbsd.cpp @@ -28,6 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +#include "os_linuxbsd.h" + +#include "main/main.h" + #include <limits.h> #include <locale.h> #include <stdlib.h> @@ -37,9 +41,6 @@ #include <sys/resource.h> #endif -#include "main/main.h" -#include "os_linuxbsd.h" - int main(int argc, char *argv[]) { #if defined(SANITIZERS_ENABLED) // Note: Set stack size to be at least 30 MB (vs 8 MB default) to avoid overflow, address sanitizer can increase stack usage up to 3 times. diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index a9725fff2e..ab79885fb4 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -74,6 +74,7 @@ void JoypadLinux::Joypad::reset() { events.clear(); } +#ifdef UDEV_ENABLED // This function is derived from SDL: // https://github.com/libsdl-org/SDL/blob/main/src/core/linux/SDL_sandbox.c#L28-L45 static bool detect_sandbox() { @@ -93,6 +94,7 @@ static bool detect_sandbox() { return false; } +#endif // UDEV_ENABLED JoypadLinux::JoypadLinux(Input *in) { #ifdef UDEV_ENABLED diff --git a/platform/linuxbsd/joypad_linux.h b/platform/linuxbsd/joypad_linux.h index 6661abdb37..26a9908d4e 100644 --- a/platform/linuxbsd/joypad_linux.h +++ b/platform/linuxbsd/joypad_linux.h @@ -32,6 +32,7 @@ #define JOYPAD_LINUX_H #ifdef JOYDEV_ENABLED + #include "core/input/input.h" #include "core/os/mutex.h" #include "core/os/thread.h" diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 8d8c8ce27b..ebdbd061d1 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -35,17 +35,13 @@ #include "main/main.h" #include "servers/display_server.h" -#include "modules/modules_enabled.gen.h" // For regex. -#ifdef MODULE_REGEX_ENABLED -#include "modules/regex/regex.h" -#endif - #ifdef X11_ENABLED #include "x11/display_server_x11.h" #endif -#ifdef HAVE_MNTENT -#include <mntent.h> +#include "modules/modules_enabled.gen.h" // For regex. +#ifdef MODULE_REGEX_ENABLED +#include "modules/regex/regex.h" #endif #include <dlfcn.h> @@ -57,6 +53,10 @@ #include <sys/utsname.h> #include <unistd.h> +#ifdef HAVE_MNTENT +#include <mntent.h> +#endif + void OS_LinuxBSD::alert(const String &p_alert, const String &p_title) { const char *message_programs[] = { "zenity", "kdialog", "Xdialog", "xmessage" }; @@ -215,48 +215,54 @@ String OS_LinuxBSD::get_name() const { } String OS_LinuxBSD::get_systemd_os_release_info_value(const String &key) const { - static String info; - if (info.is_empty()) { - Ref<FileAccess> f = FileAccess::open("/etc/os-release", FileAccess::READ); - if (f.is_valid()) { - while (!f->eof_reached()) { - const String line = f->get_line(); - if (line.find(key) != -1) { - return line.split("=")[1].strip_edges(); - } + Ref<FileAccess> f = FileAccess::open("/etc/os-release", FileAccess::READ); + if (f.is_valid()) { + while (!f->eof_reached()) { + const String line = f->get_line(); + if (line.find(key) != -1) { + String value = line.split("=")[1].strip_edges(); + value = value.trim_prefix("\""); + return value.trim_suffix("\""); } } } - return info; + return ""; } String OS_LinuxBSD::get_distribution_name() const { - static String systemd_name = get_systemd_os_release_info_value("NAME"); // returns a value for systemd users, otherwise an empty string. - if (!systemd_name.is_empty()) { - return systemd_name; + static String distribution_name = get_systemd_os_release_info_value("NAME"); // returns a value for systemd users, otherwise an empty string. + if (!distribution_name.is_empty()) { + return distribution_name; } struct utsname uts; // returns a decent value for BSD family. uname(&uts); - return uts.sysname; + distribution_name = uts.sysname; + return distribution_name; } String OS_LinuxBSD::get_version() const { - static String systemd_version = get_systemd_os_release_info_value("VERSION"); // returns a value for systemd users, otherwise an empty string. - if (!systemd_version.is_empty()) { - return systemd_version; + static String release_version = get_systemd_os_release_info_value("VERSION"); // returns a value for systemd users, otherwise an empty string. + if (!release_version.is_empty()) { + return release_version; } struct utsname uts; // returns a decent value for BSD family. uname(&uts); - return uts.version; + release_version = uts.version; + return release_version; } Vector<String> OS_LinuxBSD::get_video_adapter_driver_info() const { - if (RenderingServer::get_singleton()->get_rendering_device() == nullptr) { + if (RenderingServer::get_singleton() == nullptr) { return Vector<String>(); } - const String rendering_device_name = RenderingServer::get_singleton()->get_rendering_device()->get_device_name(); // e.g. `NVIDIA GeForce GTX 970` - const String rendering_device_vendor = RenderingServer::get_singleton()->get_rendering_device()->get_device_vendor_name(); // e.g. `NVIDIA` + static Vector<String> info; + if (!info.is_empty()) { + return info; + } + + const String rendering_device_name = RenderingServer::get_singleton()->get_video_adapter_name(); // e.g. `NVIDIA GeForce GTX 970` + const String rendering_device_vendor = RenderingServer::get_singleton()->get_video_adapter_vendor(); // e.g. `NVIDIA` const String card_name = rendering_device_name.trim_prefix(rendering_device_vendor).strip_edges(); // -> `GeForce GTX 970` String vendor_device_id_mappings; @@ -320,8 +326,8 @@ Vector<String> OS_LinuxBSD::get_video_adapter_driver_info() const { Vector<String> class_display_device_drivers = OS_LinuxBSD::lspci_get_device_value(class_display_device_candidates, kernel_lit, dummys); Vector<String> class_3d_device_drivers = OS_LinuxBSD::lspci_get_device_value(class_3d_device_candidates, kernel_lit, dummys); - static String driver_name; - static String driver_version; + String driver_name; + String driver_version; // Use first valid value: for (const String &driver : class_3d_device_drivers) { @@ -341,7 +347,6 @@ Vector<String> OS_LinuxBSD::get_video_adapter_driver_info() const { } } - Vector<String> info; info.push_back(driver_name); String modinfo; diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index c1e735b0d4..007b90b82b 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -31,13 +31,14 @@ #ifndef OS_LINUXBSD_H #define OS_LINUXBSD_H -#include "core/input/input.h" #include "crash_handler_linuxbsd.h" +#include "joypad_linux.h" + +#include "core/input/input.h" #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/alsamidi/midi_driver_alsamidi.h" #include "drivers/pulseaudio/audio_driver_pulseaudio.h" #include "drivers/unix/os_unix.h" -#include "joypad_linux.h" #include "servers/audio_server.h" #ifdef FONTCONFIG_ENABLED diff --git a/platform/linuxbsd/tts_linux.cpp b/platform/linuxbsd/tts_linux.cpp index a0cb4f5c6c..8bc83f5b9c 100644 --- a/platform/linuxbsd/tts_linux.cpp +++ b/platform/linuxbsd/tts_linux.cpp @@ -101,6 +101,24 @@ void TTS_Linux::speech_event_callback(size_t p_msg_id, size_t p_client_id, SPDNo } } +void TTS_Linux::_load_voices() { + if (!voices_loaded) { + SPDVoice **spd_voices = spd_list_synthesis_voices(synth); + if (spd_voices != nullptr) { + SPDVoice **voices_ptr = spd_voices; + while (*voices_ptr != nullptr) { + VoiceInfo vi; + vi.language = String::utf8((*voices_ptr)->language); + vi.variant = String::utf8((*voices_ptr)->variant); + voices[String::utf8((*voices_ptr)->name)] = vi; + voices_ptr++; + } + free_spd_voices(spd_voices); + } + voices_loaded = true; + } +} + void TTS_Linux::_speech_event(size_t p_msg_id, size_t p_client_id, int p_type) { _THREAD_SAFE_METHOD_ @@ -123,18 +141,13 @@ void TTS_Linux::_speech_event(size_t p_msg_id, size_t p_client_id, int p_type) { // 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++; - } - free_spd_voices(voices); + + _load_voices(); + const VoiceInfo *voice = voices.getptr(message.voice); + if (voice) { + language = voice->language; } + PackedInt32Array breaks = TS->string_get_word_breaks(message.text, language); for (int i = 0; i < breaks.size(); i += 2) { const int start = breaks[i]; @@ -174,21 +187,17 @@ Array TTS_Linux::get_voices() const { _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(!synth, Array()); + const_cast<TTS_Linux *>(this)->_load_voices(); + Array list; - SPDVoice **voices = spd_list_synthesis_voices(synth); - if (voices != nullptr) { - SPDVoice **voices_ptr = voices; - while (*voices_ptr != nullptr) { - Dictionary voice_d; - voice_d["name"] = String::utf8((*voices_ptr)->name); - voice_d["id"] = String::utf8((*voices_ptr)->name); - voice_d["language"] = String::utf8((*voices_ptr)->language) + "_" + String::utf8((*voices_ptr)->variant); - list.push_back(voice_d); - - voices_ptr++; - } - free_spd_voices(voices); + for (const KeyValue<String, VoiceInfo> &E : voices) { + Dictionary voice_d; + voice_d["name"] = E.key; + voice_d["id"] = E.key; + voice_d["language"] = E.value.language + "_" + E.value.variant; + list.push_back(voice_d); } + return list; } diff --git a/platform/linuxbsd/tts_linux.h b/platform/linuxbsd/tts_linux.h index 651a64d9d6..ec68219689 100644 --- a/platform/linuxbsd/tts_linux.h +++ b/platform/linuxbsd/tts_linux.h @@ -55,6 +55,13 @@ class TTS_Linux : public Object { int last_msg_id = -1; HashMap<int, int> ids; + struct VoiceInfo { + String language; + String variant; + }; + bool voices_loaded = false; + HashMap<String, VoiceInfo> voices; + Thread init_thread; static void speech_init_thread_func(void *p_userdata); @@ -64,6 +71,7 @@ class TTS_Linux : public Object { static TTS_Linux *singleton; protected: + void _load_voices(); 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); diff --git a/platform/linuxbsd/x11/detect_prime_x11.cpp b/platform/linuxbsd/x11/detect_prime_x11.cpp index 78778a8b56..2b5776ce54 100644 --- a/platform/linuxbsd/x11/detect_prime_x11.cpp +++ b/platform/linuxbsd/x11/detect_prime_x11.cpp @@ -28,29 +28,26 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifdef X11_ENABLED -#if defined(GLES3_ENABLED) +#if defined(X11_ENABLED) && defined(GLES3_ENABLED) #include "detect_prime_x11.h" #include "core/string/print_string.h" #include "core/string/ustring.h" -#include <stdlib.h> - #include "thirdparty/glad/glad/gl.h" #include "thirdparty/glad/glad/glx.h" #ifdef SOWRAP_ENABLED -#include "dynwrappers/xlib-so_wrap.h" +#include "x11/dynwrappers/xlib-so_wrap.h" #else #include <X11/XKBlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #endif -#include <cstring> - +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> @@ -265,5 +262,4 @@ int detect_prime() { return preferred; } -#endif -#endif +#endif // X11_ENABLED && GLES3_ENABLED diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 8ec7be97c6..83b6fb7628 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -32,12 +32,13 @@ #ifdef X11_ENABLED +#include "x11/detect_prime_x11.h" +#include "x11/key_mapping_x11.h" + #include "core/config/project_settings.h" #include "core/math/math_funcs.h" #include "core/string/print_string.h" #include "core/string/ustring.h" -#include "detect_prime_x11.h" -#include "key_mapping_x11.h" #include "main/main.h" #include "scene/resources/texture.h" @@ -58,6 +59,9 @@ #include <sys/types.h> #include <unistd.h> +#undef CursorShape +#include <X11/XKBlib.h> + // ICCCM #define WM_NormalState 1L // window normal state #define WM_IconicState 3L // window minimized @@ -65,9 +69,6 @@ #define _NET_WM_STATE_REMOVE 0L // remove/unset property #define _NET_WM_STATE_ADD 1L // add/set property -#undef CursorShape -#include <X11/XKBlib.h> - // 2.2 is the first release with multitouch #define XINPUT_CLIENT_VERSION_MAJOR 2 #define XINPUT_CLIENT_VERSION_MINOR 2 @@ -855,12 +856,30 @@ Size2i DisplayServerX11::screen_get_size(int p_screen) const { return _screen_get_rect(p_screen).size; } +// A Handler to avoid crashing on non-fatal X errors by default. +// +// The original X11 error formatter `_XPrintDefaultError` is defined here: +// https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/e45ca7b41dcd3ace7681d6897505f85d374640f2/src/XlibInt.c#L1322 +// It is not exposed through the API, accesses X11 internals, +// and is much more complex, so this is a less complete simplified error X11 printer. +int default_window_error_handler(Display *display, XErrorEvent *error) { + static char message[1024]; + XGetErrorText(display, error->error_code, message, sizeof(message)); + + ERR_PRINT(vformat("Unhandled 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)); + return 0; +} + bool g_bad_window = false; int bad_window_error_handler(Display *display, XErrorEvent *error) { if (error->error_code == BadWindow) { g_bad_window = true; } else { - ERR_PRINT("Unhandled XServer error code: " + itos(error->error_code)); + return default_window_error_handler(display, error); } return 0; } @@ -1296,7 +1315,7 @@ Ref<Image> DisplayServerX11::screen_get_image(int p_screen) const { } } else { XFree(image); - ERR_FAIL_V_MSG(Ref<Image>(), vformat("XImage with RGB mask %x %x %x and depth %d is not supported.", image->red_mask, image->green_mask, image->blue_mask, image->bits_per_pixel)); + ERR_FAIL_V_MSG(Ref<Image>(), vformat("XImage with RGB mask %x %x %x and depth %d is not supported.", (uint64_t)image->red_mask, (uint64_t)image->green_mask, (uint64_t)image->blue_mask, (int64_t)image->bits_per_pixel)); } img = Image::create_from_data(width, height, false, Image::FORMAT_RGBA8, img_data); XFree(image); @@ -5930,6 +5949,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode portal_desktop = memnew(FreeDesktopPortalDesktop); #endif + XSetErrorHandler(&default_window_error_handler); r_error = OK; } diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h index fd3a5dccfa..176a1ffb9a 100644 --- a/platform/linuxbsd/x11/display_server_x11.h +++ b/platform/linuxbsd/x11/display_server_x11.h @@ -33,7 +33,7 @@ #ifdef X11_ENABLED -#include "servers/display_server.h" +#include "joypad_linux.h" #include "core/input/input.h" #include "core/os/mutex.h" @@ -43,27 +43,28 @@ #include "drivers/alsamidi/midi_driver_alsamidi.h" #include "drivers/pulseaudio/audio_driver_pulseaudio.h" #include "drivers/unix/os_unix.h" -#include "joypad_linux.h" #include "servers/audio_server.h" +#include "servers/display_server.h" #include "servers/rendering/renderer_compositor.h" #include "servers/rendering_server.h" #if defined(SPEECHD_ENABLED) -#include "../tts_linux.h" +#include "tts_linux.h" #endif #if defined(GLES3_ENABLED) -#include "gl_manager_x11.h" +#include "x11/gl_manager_x11.h" #endif #if defined(VULKAN_ENABLED) +#include "x11/vulkan_context_x11.h" + #include "drivers/vulkan/rendering_device_vulkan.h" -#include "vulkan_context_x11.h" #endif #if defined(DBUS_ENABLED) -#include "../freedesktop_portal_desktop.h" -#include "../freedesktop_screensaver.h" +#include "freedesktop_portal_desktop.h" +#include "freedesktop_screensaver.h" #endif #include <X11/Xatom.h> @@ -72,16 +73,16 @@ #include <X11/keysym.h> #ifdef SOWRAP_ENABLED -#include "dynwrappers/xlib-so_wrap.h" +#include "x11/dynwrappers/xlib-so_wrap.h" -#include "dynwrappers/xcursor-so_wrap.h" -#include "dynwrappers/xext-so_wrap.h" -#include "dynwrappers/xinerama-so_wrap.h" -#include "dynwrappers/xinput2-so_wrap.h" -#include "dynwrappers/xrandr-so_wrap.h" -#include "dynwrappers/xrender-so_wrap.h" +#include "x11/dynwrappers/xcursor-so_wrap.h" +#include "x11/dynwrappers/xext-so_wrap.h" +#include "x11/dynwrappers/xinerama-so_wrap.h" +#include "x11/dynwrappers/xinput2-so_wrap.h" +#include "x11/dynwrappers/xrandr-so_wrap.h" +#include "x11/dynwrappers/xrender-so_wrap.h" -#include "../xkbcommon-so_wrap.h" +#include "xkbcommon-so_wrap.h" #else #include <X11/XKBlib.h> #include <X11/Xlib.h> @@ -521,6 +522,6 @@ public: ~DisplayServerX11(); }; -#endif // X11 enabled +#endif // X11_ENABLED #endif // DISPLAY_SERVER_X11_H diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp index 1e579c9f01..f24bac5e19 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.cpp +++ b/platform/linuxbsd/x11/gl_manager_x11.cpp @@ -30,15 +30,14 @@ #include "gl_manager_x11.h" -#ifdef X11_ENABLED -#if defined(GLES3_ENABLED) +#if defined(X11_ENABLED) && defined(GLES3_ENABLED) + +#include "thirdparty/glad/glad/glx.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include "thirdparty/glad/glad/glx.h" - #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 @@ -403,5 +402,4 @@ GLManager_X11::~GLManager_X11() { release_current(); } -#endif -#endif +#endif // X11_ENABLED && GLES3_ENABLED diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h index 0203dff679..59e20fec45 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.h +++ b/platform/linuxbsd/x11/gl_manager_x11.h @@ -31,12 +31,11 @@ #ifndef GL_MANAGER_X11_H #define GL_MANAGER_X11_H -#ifdef X11_ENABLED - -#ifdef GLES3_ENABLED +#if defined(X11_ENABLED) && defined(GLES3_ENABLED) #include "core/os/os.h" #include "core/templates/local_vector.h" +#include "servers/display_server.h" #ifdef SOWRAP_ENABLED #include "dynwrappers/xlib-so_wrap.h" @@ -53,8 +52,6 @@ #include <X11/extensions/shape.h> #endif -#include "servers/display_server.h" - struct GLManager_X11_Private; class GLManager_X11 { @@ -136,7 +133,6 @@ public: ~GLManager_X11(); }; -#endif // GLES3_ENABLED -#endif // X11_ENABLED +#endif // X11_ENABLED && GLES3_ENABLED #endif // GL_MANAGER_X11_H diff --git a/platform/linuxbsd/x11/key_mapping_x11.h b/platform/linuxbsd/x11/key_mapping_x11.h index 48beefff4c..ae8fd67f27 100644 --- a/platform/linuxbsd/x11/key_mapping_x11.h +++ b/platform/linuxbsd/x11/key_mapping_x11.h @@ -31,16 +31,17 @@ #ifndef KEY_MAPPING_X11_H #define KEY_MAPPING_X11_H +#include "core/os/keyboard.h" +#include "core/templates/hash_map.h" + #include <X11/XF86keysym.h> #include <X11/Xlib.h> + #define XK_MISCELLANY #define XK_LATIN1 #define XK_XKB_KEYS #include <X11/keysymdef.h> -#include "core/os/keyboard.h" -#include "core/templates/hash_map.h" - class KeyMappingX11 { struct HashMapHasherKeys { static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); } diff --git a/platform/linuxbsd/x11/vulkan_context_x11.h b/platform/linuxbsd/x11/vulkan_context_x11.h index d093bca853..294fdc710e 100644 --- a/platform/linuxbsd/x11/vulkan_context_x11.h +++ b/platform/linuxbsd/x11/vulkan_context_x11.h @@ -34,6 +34,7 @@ #ifdef VULKAN_ENABLED #include "drivers/vulkan/vulkan_context.h" + #include <X11/Xlib.h> class VulkanContextX11 : public VulkanContext { |