summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd
Commit message (Collapse)AuthorAgeFilesLines
* Modernize atomicsPedro J. Estébanez2021-02-184-7/+7
| | | | | | | | | | - Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
* Linux: Fix fallback logic when udev fails creating a contextRémi Verschelde2021-02-181-4/+6
| | | | Thanks to Noshyaar for pointing out the bug.
* Don't clobber original library symbolsHein-Pieter van Braam-Stewart2021-02-182-459/+551
| | | | | | | | | | | It appears that we can get a fun circle dependency on a shared object on some system configurations causing issues with our 'fake' function pointer names. This can lead to a crash. The new wrapper generator renames all the symbols so this can't happen anymore. See https://github.com/hpvb/dynload-wrapper/commit/704135e This closes #46140
* Dynamically load libudev.so.1 on Linux if `udev=yes`Rémi Verschelde2021-02-176-14/+1149
| | | | | | | | | | | | | | | | | | | This makes it possibly to run Linux binaries compiled with udev support on Linux systems which do not provide udev (typically systemd-less distros). If udev is missing, we fall back to parsing `/dev/input` like when compiled without udev support (`udev=no`). Also adding some verbose debug statements to know which method we're using when debugging Linux joypad issues. The libudev so wrappers were generated on Mageia 8 with libudev 246.9 using https://github.com/hpvb/dynload-wrapper: ``` ./generate-wrapper.py --include /usr/include/libudev.h --sys-include '<libudev.h>' \ --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ \ --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c ```
* Dynamically load libpulse.so.0 and libasound.so.1 on LinuxHein-Pieter van Braam-Stewart2021-02-161-3/+2
| | | | | | | | | | | | By generating stubs using https://github.com/hpvb/dynload-wrapper we can dynamically load libpulse and libasound on systems where it is available. Both are still a build-time requirement but no longer a run-time dependency. For maintenance purposes the wrappers should not need to be re-generated unless we want to bump pulse or asound to an incompatible version. It is unlikely we will want to do this any time soon. This closes #20978
* SCons: Fix debug_symbols tests after switch to BoolVariableRémi Verschelde2021-02-082-3/+3
| | | | | | Bug introduced in #45679. Fixes part of #45816.
* SCons: Add `production=yes` option to use production defaultsRémi Verschelde2021-02-031-1/+1
| | | | | | | | | | | | | | | | | | | This is meant for users making custom builds to match the options used on optimized, official builds. This enables, on the platforms which support them: - `use_static_cpp=yes` (portable binaries for Linux and Windows) - `use_lto=yes` (link time optimizations - note: requires a lot of RAM!) - `debug_symbols=no` (no debug symbols, smaller binaries) Also abort when using MSVC with `production=yes`, as: - It cannot optimize the GDScript VM like GCC or Clang do, leading to significant performance drops. - Its LTO support is unreliable, at least used to trigger crashes last we tried it extensively. All options can still be overridden if specified, and the `dev=yes` option was changed to also support overrides.
* Merge pull request #45630 from akien-mga/linux-enable-udevRémi Verschelde2021-02-011-1/+1
|\ | | | | Linux: Enable udev support by default
| * Linux: Enable udev support by defaultRémi Verschelde2021-02-011-1/+1
| | | | | | | | | | | | | | | | | | This has been enabled for years in official binaries, and users making custom builds may end up not enabling it unknowingly, so it's best if we default to the same as what official builds do. The original reason for having it opt-in was likely the addition of a dependency on libudev, but that should be fairly ubiquitous by now.
* | Linux: Build with use_static_cpp=yes by default for x86_64Rémi Verschelde2021-02-011-2/+5
|/ | | | | | | | This enables `-static-libgcc -static-libstdc++` which help make custom Linux builds more portable (official builds have been using this option for years). For some obscure reason Ubuntu 18.04 i386 crashes when using the option for i386 builds, so let's play it safe and enable for x86_64 only for now.
* Merge pull request #45315 from RandomShaper/modernize_threadRémi Verschelde2021-01-314-9/+6
|\ | | | | Modernize Thread
| * Modernize ThreadPedro J. Estébanez2021-01-294-9/+6
| | | | | | | | | | | | | | | | | | - Based on C++11's `thread` and `thread_local` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed (except for the few cases of non-portable functions) - Simpler for `NO_THREADS` - Thread ids are now the same across platforms (main is 1; others follow)
* | Unify URI encoding/decoding and add to C#Aaron Franke2021-01-282-2/+2
| | | | | | | | http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
* | Go through all event devices, not just event[0-32]Jari Ronkainen2021-01-271-4/+15
|/ | | | | | | | | | | | | There are no guarantees that joypads are in event0-event32 range. Some devices, such as laptops with detachable keyboards and wacom can reserve events all the way up to 32. Some udev rules with e.g. custom controller firmwares may load the device as /dev/input/eventX, where X is greater than 32. This patch uses POSIX dirent to enumerate the event devices, so entries outside 0-32 range are not skipped.
* Split OS::execute into two methodsMarcel Admiraal2021-01-093-12/+12
| | | | | 1. execute(): Executes a command and returns the results. 2. create_process(): Creates a new process and returns the new process' id.
* Update copyright statements to 2021Rémi Verschelde2021-01-0120-40/+40
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Merge pull request #44593 from madmiraal/rename-mainloop-methodsRémi Verschelde2020-12-281-2/+2
|\ | | | | Rename MainLoop methods to match Node methods
| * Rename MainLoop methods to match Node methodsMarcel Admiraal2020-12-221-2/+2
| |
* | Rename empty() to is_empty()Marcel Admiraal2020-12-282-4/+4
|/
* Add override keywords to core/os.h derived classes.Marcel Admiraal2020-12-171-17/+17
|
* SCons: Add only selected platform's opts to envRémi Verschelde2020-12-161-3/+0
| | | | | | | | | | | Otherwise we can get situations where platform-specific opts with the same name can override each other depending on the order at which platforms are parsed, as was the case with `use_static_cpp` in Linux/Windows. Fixes #44304. This also has the added benefit that the `scons --help` output will now only include the options which are relevant for the selected (or detected) platform.
* Fix named anonymous struct warningMarcel Admiraal2020-12-162-9/+9
|
* Merge pull request #43742 from qarmin/editor_modules_default_valuesRémi Verschelde2020-12-084-32/+22
|\ | | | | Initialize class/struct variables with default values in platform/ and editor/
| * Initialize class/struct variables with default values in platform/ and editor/Rafał Mikrut2020-12-024-32/+22
| |
* | Merge pull request #44021 from dakennedyd/personalRémi Verschelde2020-12-071-32/+114
|\ \ | | | | | | Fix implementation of move_to_trash() on Linux
| * | Fixes move_to_trash() on LinuxDavid Kennedy2020-12-071-32/+114
| |/ | | | | | | Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification
* | RenderingServer reorganizationreduz2020-12-043-4/+4
| |
* | Reorganize rendering server.reduz2020-12-031-1/+1
| | | | | | | | | | -Made RenderingServerScene abstract, allowing reimplementation -RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
* | X11: Include limits.h for LONG_MAXRémi Verschelde2020-12-021-0/+1
|/ | | | Fixes #44030.
* Merge pull request #41100 from bruvzg/ctl_text_server_interfaceRémi Verschelde2020-11-281-1/+18
|\ | | | | [Complex Text Layouts] Implement TextServer interface.
| * [Complex Text Layouts] Add third-party TextServer dependencies (ICU, ↵bruvzg2020-11-261-1/+18
| | | | | | | | HarfBuzz, Graphite).
* | Implement INCR mechanism for Linux clipboardPouleyKetchoupp2020-11-272-25/+105
|/ | | | | Allows pasting from x11 clipboard to receive data incrementally, which is required when handling data size > 256KB.
* Merge pull request #42652 from nekomatata/x11-clipboard-save-targetsRémi Verschelde2020-11-262-50/+177
|\ | | | | Implement SAVE_TARGETS mechanism for Linux clipboard
| * Implement SAVE_TARGETS mechanism for Linux clipboardPouleyKetchoupp2020-10-092-50/+177
| | | | | | | | | | | | | | | | | | | | | | | | Allows sending the clipboard content to the clipboard manager on exit to keep the content when using a clipboard manager that doesn't automatically makes a backup when copying. MULTIPLE selection mechanism also had to be implemented, because in this case, the clipboard manager might request multiple selection targets at once. Known use case: Ubuntu with XFCE4
* | SCons: Do not define TYPED_METHOD_BIND on Linux/clangRémi Verschelde2020-11-251-1/+0
| | | | | | | | It's now only needed for MSVC.
* | SCons: Remove unnecessary $LINK overridesRémi Verschelde2020-11-191-1/+0
| | | | | | | | | | | | | | | | | | | | As of SCons 4.0.1, the default value for $LINK is $SMARTLINK, which itself is a function that will use $CXX as linker for C++: https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L327-L328 https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L54-L76 So we don't need to manually specify the same value as $CXX for $LINK.
* | Remove empty lines around braces with the formatting scriptAaron Franke2020-11-161-3/+0
| |
* | Merge pull request #43461 from ccl2of4/fix-linux-joypad-dpad-zeroingRémi Verschelde2020-11-161-4/+4
|\ \ | | | | | | Fix for linux joypad D-pad zeroing
| * | Fix for linux joypad D-pad zeroingConnor Lirot2020-11-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed: ``` ABS_HAT0X : -1 ABS_HAT0Y : -1 ABS_HAT0Y : 0 ABS_HAT0Y : 1 ABS_HAT0X : 1 ``` Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible. This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction). The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely. **I have verified this issue is also reproducible in the stable 3.2 branch**
* | | Add XChangeProperty Atoms validity checks.bruvzg2020-11-151-12/+33
| | |
* | | Fixes crash if Vulkan presentation surface is not available.bruvzg2020-11-141-0/+4
| | |
* | | Add X11 Atom validity checks.bruvzg2020-11-121-15/+24
|/ /
* | Remove `debug_symbols=full` in favor of `debug_symbols=yes`Hugo Locurcio2020-11-092-6/+2
| | | | | | | | | | | | | | | | `debug_symbols=yes` will now behave like `debug_symbols=full` did before. The difference in compressed file sizes is not that large, which means there isn't much point in having two different values. This helps make the buildsystem easier to understand.
* | Reorganized core/ directory, it was too fatty alreadyreduz2020-11-074-6/+6
| | | | | | | | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* | Changed shell_open behaviourEv1lbl0w2020-10-261-6/+27
|/
* Fix x11 display server crash when deleting popup window when unfocusedPouleyKetchoupp2020-10-081-16/+21
| | | | | | | | | | | | | | | On FocusOut events, the window could be destroyed while propagating WINDOW_EVENT_FOCUS_OUT event, which causes the WindowData to be invalidated, and still used for calls to XUnsetICFocus. This change moves calls to XUnsetICFocus, and also XSetICFocus in FocusIn events, before propagating the change of focus event to the engine, to be safe in any case. Also setting xic member to nullptr after all calls to XDestroyIC to keep things clean and consistent. Fixes #42645
* Fix delay to process clipboard content from Godot in other programsPouleyKetchoupp2020-09-252-65/+80
| | | | | | | | | | | | | | | | When pasting clipboard content from Godot to other applications, multiple SelectionRequest events are sent to Godot in order to access the data. It could take a long time before the data is ready for the other app because events were processed one by one on the main thread, especially when Godot is unfocused and runs at low frequency. With this change, SelectionRequest events are directly handled on the separate event polling thread to minimize this delay. This change also replaces clipboard_get() calls in SelectionRequest with a direct access to internal_clipboard, since in this case we know Godot is the owner of the clipboard content and it's not necessary to query the x server for it.
* Fix general keyboard input lag on X11 display serverPouleyKetchoupp2020-09-242-61/+165
| | | | | | | | | | | | | | | | | | | | | | This change makes keyboard inputs more responsive on Linux, especially when the FPS is lower on slower configurations. Polling events from the x server is done on a separate thread to avoid a frame delay with inputs, due to first sending the event to the input manager with XFilterEvent then processing the new event only on the next frame. Calls to Input Manager functions like XSetICFocus, XUnsetICFocus and XSetICValues use a mutex, because they are polling events internally and would otherwise interfere with our own thread process for polling events which can cause a deadlock in some cases. XUnsetICFocus is called instead of XSetICFocus on FocusOut events, so the input manager can be properly notified of focus changes. clipboard_get now uses a blocking call to poll for a specific event type when waiting for a SelectionNotify event, instead of polling all events and filtering them afterwards.
* X11: Try to load libXrandr.so.3 if libXrandr.so.2 isn't foundRémi Verschelde2020-09-181-1/+6
| | | | | All Linux distros, and FreeBSD and OpenBSD seem to have libXrandr.so.2, but for some reason recent NetBSD versions seem to have libXrandr.so.3 now.
* Linux/BSD: Fix support for NetBSDRémi Verschelde2020-09-181-2/+10
| | | | | | | | | Add __NetBSD__ to `platform_config.h` so that it can find `alloca` and use the proper `pthread_setname_np` format. Rename RANDOM_MAX to avoid conflict with NetBSD stdlib. Fixes #42145.