Commit graph

3540 commits

Author SHA1 Message Date
Pedro J. Estébanez e745088f1f Switch to input buffering on Android
Key, touch and joystick events will be passed directly from the UI thread to Godot, so they can benefit from agile input flushing.

As another consequence of this new way of passing events, less Java object are created at runtime (`Runnable`), which is good since the garbage collector needs to run less.

`AndroidInputHandler` is introduced to have a smaller cross-thread surface. `main_loop_request_go_back()` is removed in favor just inline calling `send_window_event()` at the most caller's convenience (i.e., leveraging the new `p_deferred`` parameter as appropriate).

Lastly, `get_mouse_position()` and `get_mouse_button_state()` now just call through `Input` to avoid the need of sync of mouse data tracked on the UI thread.
2021-08-13 11:45:50 +02:00
Pedro J. Estébanez dc187324be 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-13 11:19:19 +02:00
Pedro J. Estébanez 7c864d41c9 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-13 11:19:19 +02:00
Rémi Verschelde af70288ee0
Merge pull request #51586 from m4gr3d/investigate_godot_resume_stalls_master
Resolve issue where the Godot app remains stuck when resuming.
2021-08-13 08:43:59 +02:00
Rémi Verschelde 4c53669d8a
Merge pull request #51524 from RandomShaper/faster_vma
Upgrade Vulkan Memory Allocator, use Volk on Android
2021-08-13 08:42:58 +02:00
Fredia Huya-Kouadio e73e336e3b Add support for prompting the user to retain app data on uninstall.
Supported on Android 10 and higher.
2021-08-12 22:16:14 -07:00
Fredia Huya-Kouadio 28a99e4cf6 Resolve issue where the Godot app remains stuck when resuming.
This was caused by the fact that a new instance of Godot was created at resume while a previous instance already existed.
The previous instance would then go through its cleanup lifecycle, and would thus attempt to close the entire app, leading to the system to restart the app, thus starting the cycle anew.
The fix involves reusing the previous instance of Godot if one is available instead of creating a new one, as well as giving control to the host activity for how the process should be terminated.
2021-08-12 21:05:18 -07:00
Pedro J. Estébanez 7b7e17a626 Upgrade Vulkan memory allocator 2021-08-13 00:05:41 +02:00
Rémi Verschelde 554312a3b2
Android: Use volk instead of NDK Vulkan headers
We no longer build the Vulkan loader, and volk lets us load it dynamically.
Roblox uses volk on Android so it should work well for us too.
2021-08-12 23:39:30 +02:00
Rémi Verschelde 6f043f7a19
Merge pull request #50771 from naithar/feature/platform-export-refactoring-4.0 2021-08-12 17:22:43 +02:00
Sergey Minakov 253581f85c Split uwp platform export template into multiple files 2021-08-12 17:18:37 +03:00
Sergey Minakov 9f49255bee Split javascript export template into multiple files 2021-08-12 17:18:36 +03:00
Sergey Minakov 6627f18e0f Split windows platform export template into multiple files 2021-08-12 17:18:36 +03:00
Sergey Minakov d18dc7f41c Split osx platform export template into multiple files 2021-08-12 17:18:34 +03:00
Sergey Minakov ed49e038ec Split android platform export template into multiple files 2021-08-12 17:15:02 +03:00
Sergey Minakov 968b712a97 Split iphone platform export template into multiple files 2021-08-12 16:56:17 +03:00
Marcus Brummer 20b3e2cc94 Properly finishes Godot's Android activity when destroyed by the system 2021-08-12 15:33:51 +02:00
bruvzg 133f678f85 Remove unnecessary iOS linker flags. 2021-08-12 14:25:16 +03:00
bruvzg d7957a2a20 Use "volk" instead of statically linked Vulkan loader. 2021-08-12 14:25:15 +03:00
Aaron Franke fa3a32a2d6
Use Key enum instead of plain integers 2021-08-10 16:26:55 -05:00
bruvzg ae7dbb678c [macOS] Move captured mouse cursor to the center when window gain focus. 2021-08-08 22:27:57 +03:00
Sergey Minakov ae91e372d1 [iOS] Use platform generated api to initialize iOS plugins 2021-08-06 23:28:37 +03:00
Georg Wacker 63ba15a518 Fix vertical scroll/zoom for precision touchpad
Adds factor data for vertical mousewheel event, in line with horizontal mousewheel event
2021-08-06 15:06:11 +02:00
Haoyu Qiu 1d5332069b Make progress and errors translatable when exporting to Android 2021-08-01 17:16:16 +08:00
Rémi Verschelde c191cfbddf
Windows: Fix build with SCons 4.2.0 2021-08-01 10:08:20 +02:00
Fredia Huya-Kouadio ace6df6947 Fix custom build export 2021-07-27 09:15:45 -07:00
vitika9 1add8b3172 Removed Redundant assignement of name inside configure_joypad function 2021-07-27 14:51:42 +05:30
Rémi Verschelde 438be4422f
Merge pull request #50878 from bruvzg/debug_entitlement
[macOS] Add "debugging" (`get-task-allow`) to the export options.
2021-07-26 10:52:09 +02:00
bruvzg 2dd6c3eb09 [macOS] Add "debugging" (get-task-allow) to the export options, to allow using native debugger. 2021-07-26 11:28:52 +03:00
luz paz 2e0044c93d Remove unnecessary 'pass' statement
ref: https://lgtm.com/projects/g/godotengine/godot/?mode=tree&ruleFocus=910088
2021-07-25 11:56:24 -04:00
luz paz 3564c16cb8
Fix various typos with codespell
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25 11:21:51 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
bruvzg 618eb27e8b Move alert function from DisplayServer to OS. 2021-07-22 21:50:35 +03:00
bruvzg 53f84e39fd Fix MoltenVK static linking on macOS (add missing include path, Vulkan SDK path option, use xcframework instead of static framework). 2021-07-22 16:29:24 +03:00
Rémi Verschelde ab732fe3eb
Merge pull request #50712 from nekomatata/x11-popup-focus-fix
Fix popup closing immediately after showing on some Linux WMs
2021-07-22 09:27:48 +02:00
PouleyKetchoupp e030360b88 Fix popup closing immediately after showing on some Linux WMs
When a popup is going to be closed, switch focus to the parent only if
the popup is still being focused.

Fixes some cases with specific WMs where due to the order of events, a
new popup could be immediately unfocused because a previously opened
and closed popup is switching focus to the parent.
2021-07-21 12:28:39 -07:00
ne0fhyk fa587778d8 Disable resource optimizations for release builds as it breaks the legacy build system. 2021-07-20 16:44:04 -07:00
Rémi Verschelde b4baec08cf
Merge pull request #50206 from groud/undoredo_increase_args_count
Increase the number of arguments accepted by UndoRedo methods
2021-07-20 09:50:01 +02:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Hendrik Brucker 38578a8095 Modernize Display server to use override keyword 2021-07-16 21:39:13 +02:00
Rémi Verschelde 296b713ee8
Merge pull request #50481 from reduz/install-android-build-sources
Added ability to load Android build sources from file.
2021-07-15 18:22:26 +02:00
Fabio Alessandrelli 7431586286 [HTML5] Make threads build the default.
Non-threads build are broken anyway.
2021-07-15 15:33:39 +02:00
reduz 6639cc9853 Addes ability to load build sources from file.
* If not present, the dialog asks to load build sources from a file.
* The export templates check now also verifies that build sources are installed and skips the template check.

This makes Android development easier.
2021-07-15 10:14:08 -03:00
Fabio Alessandrelli 3d8acc7a54 [HTML5] Fix build (with module_webxr_enabled=no).
The XR API changed a bit, and it's not just a rename, though probably an
easy update for someone who is qualified :).
2021-07-15 14:37:21 +02:00
Rémi Verschelde 06568bbfdf
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
2021-07-15 00:46:43 +02:00
Rémi Verschelde dcabc27337
Merge pull request #50409 from godot-joe/fix-ambiguous-variant-on-debian-10-build
Fixes ambiguous variant error for build on Debian 10 (Buster) using clang v7
2021-07-14 14:58:36 +02:00
Sergey Minakov aa321f0a24 [iOS] Fix plugin configuration loading
Clear ConfigFile parameter before loading new file.
Ignore duplicate input plist keys
2021-07-13 21:30:19 +03:00
Rémi Verschelde 681b1bb306
Merge pull request #50422 from Faless/js/4.x_memory_initial_32
[HTML5] Raise default initial memory to 32 MiB.
2021-07-13 17:02:22 +02:00
Rémi Verschelde a4af76077a
Merge pull request #50418 from Calinou/fix-to-stop-word-casing
Fix casing of the "to" stop word in editor strings
2021-07-13 16:26:21 +02:00
Fabio Alessandrelli 897c906ebf [HTML5] Raise default initial memory to 32 MiB.
The memory was resized in any case during start.

Mitigate Chromium issue:
https://bugs.chromium.org/p/v8/issues/detail?id=11863

Also fix a warning about SAFE_HEAP being a linker only flag.
2021-07-13 15:51:00 +02:00