Commit graph

2961 commits

Author SHA1 Message Date
bruvzg 1c27d4a73d
[macOS] Add entitlements config and export template dylib signing to the export. 2021-03-03 12:40:44 +02: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
Rémi Verschelde 8385a0d8ad
Merge pull request #46458 from m4gr3d/fix_invalid_missing_templates_error
[3.2] Fix invalid missing template error when the Android build template is not installed
2021-02-27 16:52:41 +01:00
Fredia Huya-Kouadio 92d3287648 Fix invalid missing template error when the Android build template is not installed. 2021-02-26 12:28:19 -08:00
Fredia Huya-Kouadio c5fb32d594 Update the logic to load Godot Android plugins packaged into the binary.
The previous logic had the side effect of imposing a limit of one plugin per `aar` binary. The update lifts that restriction.
2021-02-26 09:09:40 -08:00
Fabio Alessandrelli 43e429fa93 [HTML5] Add jsdoc2rst tool.
A template for `jsdoc` that generat the HTML5 public classref.

The script can be run via `npm run docs` to print to stdout.

You can dry run via `npm run docs -- --d dry-run` or write to file via
`npm run docs -- -d /path/to/file.rst`

Also update Makefile in `doc/` and add dry run test to CI.

(cherry picked from commit 472482013e)
2021-02-26 15:35:45 +01:00
Fabio Alessandrelli 681c10af45 [HTML5] Document Engine and EngineConfig (jsdoc).
This commit also removes the utils.js engine file, moving some of it's
content to config.js and some to engine.js .

(cherry picked from commit 018ee5a4dc)
2021-02-26 15:35:38 +01:00
Fabio Alessandrelli e3664e971b [HTML5] Make editor HTML build tag scons4-proof.
We used to have it like `$GODOT_VERSION` which caused inconsistencies
between different scons versions when substituting it.
It's now `@GODOT_VERSION@`, which is safe on both scons3 and scons4.

(cherry picked from commit 4404eb57e4)
2021-02-26 15:22:51 +01:00
PouleyKetchoupp ea1d4256a4 Added LocalVector to Visual Studio debugger visualization
(cherry picked from commit 27d5e1fff0)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 65eb5fdf1e Update the initialization timeline for the Godot fragment to be more consistent with the previous activity based timeline.
(cherry picked from commit 3ce7678374)
2021-02-25 15:14:32 +01:00
Fredia Huya-Kouadio 9fb5215db5 Add logic to record the version of the Godot engine for the Android platform.
(cherry picked from commit bc5120eb97)
2021-02-25 15:14:32 +01:00
Rémi Verschelde 693a27e9dd
Merge pull request #46336 from m4gr3d/fix_android_resources_inclusion
[3.2] Update the filtering logic to properly handle directories with `.gdignore` files
2021-02-25 14:15:19 +01:00
Hein-Pieter van Braam-Stewart 5f71fad6b6 Allow static linking with libatomic using clang
When using use_static_cpp we want to statically link with atomic as well
to make sure we don't incur any new runtime dependencies.

Scons doesn't quite support this so we do this little trick.
2021-02-23 14:48:51 +01:00
Fredia Huya-Kouadio 48108444f1 Update the filtering logic to properly handle directories with .gdignore files. 2021-02-22 20:18:56 -08:00
Hein-Pieter van Braam-Stewart 5ff172e34d Use -latomic when using clang (server platform)
version of c9b3a00a63 for the server
platform

(cherry picked from commit 6a146d405c)
2021-02-22 21:39:22 +01:00
Pedro J. Estébanez c75b3fedc4 Fix build error in UWP 2021-02-22 17:57:27 +01:00
Rémi Verschelde d1f023c35b SCons: Fix UWP build after #45618 2021-02-22 15:30:48 +01:00
Hein-Pieter van Braam f15f5b4578
Merge pull request #46242 from hpvb/dri-prime-amd
[3.2] Add 'AMD' GPU vendor name to PRIME detector
2021-02-20 17:19:04 +01:00
Hein-Pieter van Braam-Stewart 0cce213f14 Use -latomic when linking whe using clang on Linux
According to the LLVM documentation when using GNU's libstdc++ clang
will not automatically link with -latomic. This is necessary since we
merged c++11 atomics support.

This fixes linking using Clang on Linux
2021-02-20 16:37:00 +01:00
Hein-Pieter van Braam-Stewart 92687b4544 Add 'AMD' GPU vendor name to PRIME detector
Apparently some recent Mesa version also changed AMD's vendor string. In
addition I found a small uninitialized variable that's corrected now.
2021-02-20 02:03:05 +01:00
Rémi Verschelde 0d94bf707f
Merge pull request #46201 from Faless/js/3.x_canvas_size_pr
[3.2] [HTML5] Easier HTML templates, better canvas size handling.
2021-02-19 15:16:59 +01:00
Fabio Alessandrelli 45a67fab35 [HTML5] Better fullscreen, canvas resizing.
Three canvas resize policies:
- `None`: Godot window settings are ignored.
- `Project`: Godot handles the canvas like a native app (resizing it
  when setting the window size).
- `Adaptive`: Canvas size will always adapt to browser window size.

Use `None` if you want to control the canvas size with custom JavaScript
code.
2021-02-19 05:13:44 +01:00
Fabio Alessandrelli 1eef8a318b [HTML5] Easier HTML templates, better deinit/cleanup. 2021-02-19 05:13:44 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Fredia Huya-Kouadio ca6e1c1c45
Override ANDROID_NDK_ROOT based on the project ndk version.
This helps resolve issues where the project ndk version differs from the one pointed by the `ANDROID_NDK_ROOT` environment variable (if it exists).

(cherry picked from commit edeca16fb6)
2021-02-18 14:59:10 +01:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- 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` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Fredia Huya-Kouadio ef9d945e16 Disable engine splash logic on Android; this is now handled by the Android theme api.
In addition, add support for scaling and applying filter to the splash screen on Android.
One limitation of the api being used is that the splash screen aspect ratio is not maintained when it's scaled up.
2021-02-18 03:17:58 -08: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 8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- 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`
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
Pedro J. Estébanez b450036120 Modernize RWLock
- Based on C++14's `shared_time_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`
2021-02-18 11:41:07 +01:00
Fredia Huya-Kouadio 96a3f01ac5
Add missing ndkVersion to the library gradle build config.
(cherry picked from commit 9418197081)
2021-02-18 10:37:59 +01:00
Fredia Huya-Kouadio 1557bc8396
Revert AGP to version 4.0.1 as a workaround to https://issuetracker.google.com/issues/171235570 in version 4.1.x
(cherry picked from commit e5311f3523)
2021-02-18 10:37:28 +01:00
Rémi Verschelde ad7710ae5e
Dynamically load libudev.so.1 on Linux if udev=yes
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
```

(cherry picked from commits a10c259c1d
and e26a1f807b)

Edit: Updated to version 0.2 of dynload-wrapper to fix symbols clobbering as
done in #46143.
2021-02-18 10:31:31 +01:00
Rémi Verschelde 48b73e4532
Android: Bump NDK version to 21.4.7075529
This is what GitHub Actions now provide and they removed the previous 21.3.6528147.
A bit annoying to have our hand forced this way but it's still 21.x so should be good
to upgrade.

(cherry picked from commit c730da8b20)
2021-02-18 00:36:46 +01:00
Quadtree a81f896ec1
Add cwrap to EXTRA_EXPORTED_RUNTIME_METHODS
(cherry picked from commit d2c34e83b5)
2021-02-18 00:35:57 +01:00
Fredia Huya-Kouadio d559def1a9 Add verbose logging to help with troubleshooting the Android build/export process. 2021-02-17 13:30:01 -08:00
Fabio Alessandrelli 03edba4d75 [HTML5] Implement get_processor_count. 2021-02-17 13:42:26 +01:00
Hein-Pieter van Braam-Stewart 228803e9db Dynamically load libpulse.so.0 and libasound.so.1 on Linux
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.

cherry-pick from 09f82fa6ea
2021-02-17 10:31:52 +01:00
Fredia Huya-Kouadio 64f5a7b8ca Expose GodotPlugin's utility methods used for registration and signal emitting.
This enables creation and use of a plugin like class by composition rather than inheritance.
2021-02-15 15:57:36 -08:00
Rémi Verschelde 40c30adf04
Merge pull request #46034 from bruvzg/ignore_warp_on_mode_change_3
[macOS, 3.2] Ignore mouse move event caused by mouse mode switch.
2021-02-15 11:09:28 +01:00
bruvzg bc04bbbe2a
[macOS] Ignore mouse move event caused by mouse mode switch. 2021-02-15 00:19:47 +02:00
Fabio Alessandrelli b3f78687de [HTML5] Detect screen scale and DPI.
`OS.get_screen_scale` will now return the `window.devicePixelRatio`
value, `OS.get_screen_dpi` uses CSS media queries to find approximate
DPI value for the current display.
`OS.get_screen_size` also return the actual screen size (not the CSS
pixel size).
2021-02-12 12:02:30 +01:00
Rémi Verschelde b2f925ea42
Merge pull request #45889 from Faless/js/3.x_xhr_fix
[3.2] [HTML5] Fix HTTPClient request_raw.
2021-02-11 11:08:14 +01:00
Rémi Verschelde 6f26df58a8
Merge pull request #45884 from Faless/js/3.x_more_handlers
[3.2] [HTML5] Handle contextmenu, webglcontextlost internally.
2021-02-11 10:53:41 +01:00
Fabio Alessandrelli 4086a123b9 [HTML5] Fix HTTPClient request_raw.
Now send data according to the spec, properly handle null data.
Simplify JS code since we are at it.
2021-02-11 09:32:17 +01:00
Fabio Alessandrelli 8c9a503bde [HTML5] Handle contextmenu, webglcontextlost internally.
This way they are automatically cleaned up when the engine exits,
landing a hand to browsers garbage collectors.
2021-02-11 08:00:53 +01:00
Rémi Verschelde 5bec2cf3d4
Merge pull request #45772 from CherokeeLanguage/3.2
[3.2] Fix issue with NVIDIA and axis mapping for joysticks.
2021-02-10 17:04:05 +01:00
Michael Conrad 8777282c40 Fix joystick axis mapping issues with NVIDIA shield. Probably others.
Issues addressed:

a) Axis mappings were including virtual mouse axes on NVIDIA Shield TV.

The virtual mouse axes have the same axis numbers as the normal analog stick numbers. This was completely breaking joypad support on NVIDIA Shield TV.

b) Joypads were being tracked in a List with the index in the list being treated as the Godot device id.

If a device were to be removed, any device later in the list would be shifted, potentially causing future events with the shifted joypads to have incorrect IDs according to the Godot engine.

c) Unnecessary events were being sent to the Godot engine.

A check was added (per Joystick) that will prevent sending events for all axes when only a single axis value changed.
A similar check was added for "HATs".

See #45712
2021-02-09 08:33:42 -05:00