Commit Graph

419 Commits

Author SHA1 Message Date
bruvzg bea7c9be5d [3.x] Improve embedded PCK loading and exporting. 2022-04-28 11:11:48 +03:00
Haoyu Qiu 95d861694a Fix several OS_X11 memory leaks 2022-04-26 08:39:55 +08:00
Haoyu Qiu bccd23f4bf Fix memory leak when handling Linux primary clipboard 2022-04-01 21:55:53 +08:00
ConteZero 59fb6c9ef0 Fix X11 is_window_maximized 2022-03-31 23:10:32 +02:00
ConteZero 2ff0735329 Added primary clipboard for Linux 2022-03-14 15:28:36 +01:00
Hugo Locurcio cec7c908ca
Add `get_screen_refresh_rate()` to OS
This method can be used to get the refresh rate of a given screen.
It is supported on Windows, macOS, Linux, Android and iOS (but not
HTML5).
2022-03-10 22:10:48 +01:00
Rémi Verschelde 8975470bc2
Merge pull request #58336 from maiself/fix-directory-delete-linux-3.x 2022-03-10 21:29:55 +01:00
Haoyu Qiu 9d6f4a76d1 Fix X11 memory leak after drag & drop file into the editor 2022-03-04 17:50:28 +08:00
Mai Lavelle 2c00b90613 Fix deleting of directories on Linux
Trailing slash of directories was mishandled, and incorrect derived paths
were formed. Stripping the slash fixes this.
2022-02-20 08:43:44 -05:00
Hugo Locurcio 7f9e974a8b
Add an `OS.get_processor_name()` method
This method can be used to get the CPU model name.
It can be used in conjunction with
`VisualServer.get_video_adapter_name()` and
`VisualServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
2022-02-16 18:39:02 +01:00
Rémi Verschelde 7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
Haoyu Qiu f8afd16c89
Fix memory leak when move to trash fails on Linux
(cherry picked from commit 8be49838b3)
2022-01-25 18:55:52 +01:00
Rémi Verschelde ed869729ae
Merge pull request #56755 from madmiraal/fix-45592-3.x 2022-01-24 10:06:24 +01:00
Rémi Verschelde 879244c54e
Merge pull request #56015 from bruvzg/phy_code_conv 2022-01-16 11:36:26 +01:00
Rémi Verschelde a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Marcel Admiraal b7545631de Use mouse event relative motion to calculate mouse speed 2022-01-13 10:29:57 +00:00
bruvzg 6f81a8ee2c
Fix multiple missing UTF-8 decoding.
(cherry picked from commit c69e0d16bc)
2022-01-06 21:44:40 +01:00
Marcel Admiraal 913855926d Fix tablet tilt values returning bad values 2022-01-02 12:16:04 +00:00
bruvzg b4ec1c5817
Backport: Allow for mapping scancodes to current layout
Co-authored-by: Frixuu <kontakt@lukasz.xyz>
2021-12-17 13:04:47 +02:00
Rémi Verschelde 1f8497d281
Merge pull request #53411 from RandomShaper/ubershaders_3.x 2021-11-09 13:12:44 +01:00
Pedro J. Estébanez abdf931832 Add off-screen GL context 2021-11-09 12:19:12 +01:00
Rémi Verschelde c7c592f832
Merge pull request #54314 from nekomatata/x11-events-log-3.x 2021-11-09 00:03:39 +01:00
Rémi Verschelde 2c47e33905
Merge pull request #54313 from nekomatata/x11-fix-input-delay-3.x 2021-11-02 08:53:06 +01:00
Rémi Verschelde 1b65550ec7
clang-format: Various fixes to comments alignment from `clang-format` 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde 42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
PouleyKetchoupp 2a638a9cdf Add X11 events logging for debug purpose
Compiled out by default, just to be used for debugging local builds.
2021-10-27 10:37:46 -07:00
PouleyKetchoupp 874c9ae89a Fix input events random delay on X11
The new system based on a thread gathering events from the X11 server
was causing delays in some scenarios where some events have just been
missed at the time of processing and we're waiting for a whole frame to
check them again.

Solved by flushing again and checking for pending events at the
beginning of the process loop, in addition to events already gathered
on the event thread.
2021-10-27 10:19:16 -07:00
Omar Polo 04c08d1f8c
use .get_file() instead of basename(3)
On OpenBSD the compiler complains that calling basename(3) would lose
const qualifier.  basename(3) is defined as

	char *basename(char *);

and can, accorgindly to the POSIX.1, modify the passed string.

This uses the .get_file() method.  The check is necessary because
file_name could be a directory, in which case .get_file() would return
an empty string.  The .get_base_dir().get_file() idiom is already used.

The usage of get_file() and the check were suggested by theraot, thanks!

(cherry picked from commit a3384b7461)
2021-10-10 12:27:51 +02:00
Hugo Locurcio a5d027e542
Mention that rebooting is required after updating graphics driver on X11 2021-09-15 18:25:49 +02:00
ne0fhyk c88d1608ab Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-13 11:04:17 -07:00
Pedro J. Estébanez 7be9c26e20 Add input buffering framework
Input buffering is implicitly used by event accumulation, but this commit makes it more generic so it can be enabled for other uses.

For desktop OSs it's currently not feasible given main and UI threads are the same).
2021-08-08 12:37:55 +02:00
Pedro J. Estébanez 58a54f534e Improve input event accumulation
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag.
- Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes).
- Touch drag events now support accumulation.
2021-08-08 12:37:55 +02:00
Hugo Locurcio 8fbdcb6fea
Point at software OpenGL when OpenGL fails to initialize on X11 2021-08-05 18:24:42 +02:00
David Kennedy 72db6016ba
Fixes move_to_trash() on Linux
Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification

(cherry picked from commit 8b68c6808d)
2021-07-15 10:39:47 +02:00
Marcel Admiraal 5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Hugo Locurcio 12236d2868
Only allow absolute paths in XDG environment variables
The XDG Base Directory specification does not allow using relative paths
(which broke things in Godot anyway). If a relative path is detected,
it should be ignored.

(cherry picked from commits 011a99316a
and 0e1d45b210)
2021-05-21 12:53:11 +02:00
bruvzg dab4cf3ed6
Add `physical_scancode` (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2021-05-06 23:19:45 +03:00
Rémi Verschelde 140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde 03dda90ddd Linux: Fix PRIME detection on Steam
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g.
Renderdoc or Primus, we skip detection if there's a `libGL.so` in
`LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes
system paths too, thus the actual system `libGL`... 🤦

So if we detect Steam, we skip this check.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>

(cherry picked from commit 562b1cd2cda2098e62c7501dae87393def99c23a)
2021-03-08 16:03:24 +01:00
Ev1lbl0w be4e34b495
Prevent invalid values when resizing window (X11) 2021-03-01 12:22:16 +00:00
Pedro Rodrigues 66da113237 Fix out of bounds array access on OS_X11 code
The problem happened on methods `get_screen_position`, `get_screen_size`
and `set_current_screen` when they were passed a negative screen value.

Fixes:
- #46184
- #46185
- #46186
2021-02-28 17:20:04 +00:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- 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)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
Marcel Admiraal 4e833b2e28 Fix used uninitialized warning in os_x11.cpp 2021-02-06 10:43:02 +00:00
Samuele Zolfanelli 36635c8357 Added atom checks to x11 XChangeProperty and XGetWindowProperty 2021-02-03 16:08:37 +01:00