diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/crash_handler_x11.cpp | 1 | ||||
-rw-r--r-- | platform/x11/detect.py | 7 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 84 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 12 |
4 files changed, 78 insertions, 26 deletions
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp index 3c54d5cbc2..005a7459f9 100644 --- a/platform/x11/crash_handler_x11.cpp +++ b/platform/x11/crash_handler_x11.cpp @@ -33,6 +33,7 @@ #include "main/main.h" #include "os_x11.h" +#include "project_settings.h" #ifdef CRASH_HANDLER_ENABLED #include <cxxabi.h> diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 8c68c9ffd1..3d07851c4f 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -52,7 +52,6 @@ def get_opts(): BoolVariable('use_static_cpp', 'Link stdc++ statically', False), BoolVariable('use_sanitizer', 'Use LLVM compiler address sanitizer', False), BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False), - BoolVariable('use_lto', 'Use link time optimization', False), BoolVariable('pulseaudio', 'Detect & use pulseaudio', True), BoolVariable('udev', 'Use udev for gamepad connection callbacks', False), EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), @@ -101,6 +100,10 @@ def configure(env): ## Compiler configuration + if 'CXX' in env and 'clang' in env['CXX']: + # Convenience check to enforce the use_llvm overrides when CXX is clang(++) + env['use_llvm'] = True + if env['use_llvm']: if ('clang++' not in env['CXX']): env["CC"] = "clang" @@ -233,7 +236,7 @@ def configure(env): env.ParseConfig('pkg-config zlib --cflags --libs') env.Append(CPPPATH=['#platform/x11']) - env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL']) + env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL']) env.Append(LIBS=['GL', 'pthread']) if (platform.system() == "Linux"): diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d13aa4b8b5..d1aa129e77 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -32,7 +32,6 @@ #include "errno.h" #include "key_mapping_x11.h" #include "print_string.h" -#include "servers/physics/physics_server_sw.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" @@ -83,10 +82,6 @@ const char *OS_X11::get_video_driver_name(int p_driver) const { return "GLES3"; } -OS::VideoMode OS_X11::get_default_video_mode() const { - return OS::VideoMode(1024, 600, false); -} - int OS_X11::get_audio_driver_count() const { return AudioDriverManager::get_driver_count(); } @@ -434,12 +429,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au requested = None; visual_server->init(); - // - physics_server = memnew(PhysicsServerSW); - physics_server->init(); - //physics_2d_server = memnew( Physics2DServerSW ); - physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>(); - physics_2d_server->init(); input = memnew(InputDefault); @@ -447,7 +436,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au #ifdef JOYDEV_ENABLED joypad = memnew(JoypadLinux(input)); #endif - _ensure_data_dir(); + _ensure_user_data_dir(); power_manager = memnew(PowerX11); @@ -504,12 +493,6 @@ void OS_X11::finalize() { memdelete(visual_server); //memdelete(rasterizer); - physics_server->finish(); - memdelete(physics_server); - - physics_2d_server->finish(); - memdelete(physics_2d_server); - memdelete(power_manager); if (xrandr_handle) @@ -1948,6 +1931,39 @@ bool OS_X11::_check_internal_feature_support(const String &p_feature) { return p_feature == "pc" || p_feature == "s3tc"; } +String OS_X11::get_config_path() const { + + if (has_environment("XDG_CONFIG_HOME")) { + return get_environment("XDG_CONFIG_HOME"); + } else if (has_environment("HOME")) { + return get_environment("HOME").plus_file(".config"); + } else { + return "."; + } +} + +String OS_X11::get_data_path() const { + + if (has_environment("XDG_DATA_HOME")) { + return get_environment("XDG_DATA_HOME"); + } else if (has_environment("HOME")) { + return get_environment("HOME").plus_file(".local/share"); + } else { + return get_config_path(); + } +} + +String OS_X11::get_cache_path() const { + + if (has_environment("XDG_CACHE_HOME")) { + return get_environment("XDG_CACHE_HOME"); + } else if (has_environment("HOME")) { + return get_environment("HOME").plus_file(".cache"); + } else { + return get_config_path(); + } +} + String OS_X11::get_system_dir(SystemDir p_dir) const { String xdgparam; @@ -2243,6 +2259,38 @@ Error OS_X11::move_to_trash(const String &p_path) { return err; } +OS::LatinKeyboardVariant OS_X11::get_latin_keyboard_variant() const { + + XkbDescRec *xkbdesc = XkbAllocKeyboard(); + ERR_FAIL_COND_V(!xkbdesc, LATIN_KEYBOARD_QWERTY); + + XkbGetNames(x11_display, XkbSymbolsNameMask, xkbdesc); + ERR_FAIL_COND_V(!xkbdesc->names, LATIN_KEYBOARD_QWERTY); + ERR_FAIL_COND_V(!xkbdesc->names->symbols, LATIN_KEYBOARD_QWERTY); + + char *layout = XGetAtomName(x11_display, xkbdesc->names->symbols); + ERR_FAIL_COND_V(!layout, LATIN_KEYBOARD_QWERTY); + + Vector<String> info = String(layout).split("+"); + ERR_FAIL_INDEX_V(1, info.size(), LATIN_KEYBOARD_QWERTY); + + if (info[1].find("colemak") != -1) { + return LATIN_KEYBOARD_COLEMAK; + } else if (info[1].find("qwertz") != -1) { + return LATIN_KEYBOARD_QWERTZ; + } else if (info[1].find("azerty") != -1) { + return LATIN_KEYBOARD_AZERTY; + } else if (info[1].find("qzerty") != -1) { + return LATIN_KEYBOARD_QZERTY; + } else if (info[1].find("dvorak") != -1) { + return LATIN_KEYBOARD_DVORAK; + } else if (info[1].find("neo") != -1) { + return LATIN_KEYBOARD_NEO; + } + + return LATIN_KEYBOARD_QWERTY; +} + OS_X11::OS_X11() { #ifdef PULSEAUDIO_ENABLED diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index eeb951e8bd..a74e6ee5f3 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -42,9 +42,6 @@ #include "main/input_default.h" #include "power_x11.h" #include "servers/audio_server.h" -#include "servers/physics_2d/physics_2d_server_sw.h" -#include "servers/physics_2d/physics_2d_server_wrap_mt.h" -#include "servers/physics_server.h" #include "servers/visual/rasterizer.h" #include <X11/Xcursor/Xcursor.h> @@ -121,10 +118,8 @@ class OS_X11 : public OS_Unix { uint64_t last_click_ms; uint32_t last_button_state; - PhysicsServer *physics_server; unsigned int get_mouse_button_state(unsigned int p_x11_state); void get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state); - Physics2DServer *physics_2d_server; MouseMode mouse_mode; Point2i center; @@ -182,7 +177,6 @@ class OS_X11 : public OS_Unix { protected: virtual int get_video_driver_count() const; virtual const char *get_video_driver_name(int p_driver) const; - virtual VideoMode get_default_video_mode() const; virtual int get_audio_driver_count() const; virtual const char *get_audio_driver_name(int p_driver) const; @@ -222,6 +216,10 @@ public: virtual void make_rendering_thread(); virtual void swap_buffers(); + virtual String get_config_path() const; + virtual String get_data_path() const; + virtual String get_cache_path() const; + virtual String get_system_dir(SystemDir p_dir) const; virtual Error shell_open(String p_uri); @@ -278,6 +276,8 @@ public: virtual Error move_to_trash(const String &p_path); + virtual LatinKeyboardVariant get_latin_keyboard_variant() const; + OS_X11(); }; |