Commit graph

2977 commits

Author SHA1 Message Date
Fabio Alessandrelli
0813008b8a [HTML5] Enforce JavaScript style with eslint.
Applies to javascript files inside the platform library folder, the
exposed Engine code, and any javascript files in modules.

Files ending with ".externs.js" will be ignored, you can create a
".eslintignore" file to specify extra files to be ignored.
2020-11-23 13:26:19 +01:00
Fredia Huya-Kouadio
d13d29240c Update gradle build files to automatically perform signing and zipalign tasks for custom builds. 2020-11-22 17:54:12 -08:00
Fabio Alessandrelli
e4cdae3624 [HTML5] Libraries refactor for linting.
Initial work to make liniting easier.

This includes:
- Rename http_request.js to library_godot_http_request.js.
- Rename externs.js to engine.externs.js.
- New library_godot_runtime.js (GodotRuntime) wraps around emscripten
  functions.
- Refactor of XMLHttpRequest handler in engine/preloader.js.
- Few fixes to bugs spotted by early stage linting.
2020-11-21 14:23:32 +01:00
Fredia Huya-Kouadio
16181a38eb
Fix zipalign command name on Windows machines.
(cherry picked from commit c4f2d87747)
2020-11-19 17:15:28 +01:00
Rémi Verschelde
387597a4a4
OSX: Fix linking with osxcross for arm64
For some reason the `-target` option on the `LINKFLAGS` was causing a weird
issue where osxcross' clang wrapper would attempt using the system `/bin/ld`
instead of the osxcross version (which is Apple's `ld64`).

The error message would be:
```
/bin/ld: unrecognized option '-dynamic'
```

Also removed from `CCFLAGS` for consistency, it seems to work fine with only
`-mmacosx-version-min`.

(cherry picked from commit dbbbb53927)
2020-11-19 17:15:27 +01:00
bruvzg
bc25b80c0f
[macOS / ARM64] Remove "-msse2" flag from ARM64 release export template build.
(cherry picked from commit 09f301029a)
2020-11-19 17:14:56 +01:00
PouleyKetchoupp
336506a273
OSX: Fix compiling for arm64 with OSXCross
(cherry picked from commit 08b0fd4330)
2020-11-19 17:14:52 +01:00
bruvzg
718ff146e0
Fix focus loss on macOS. 2020-11-19 11:55:25 +02:00
Pedro J. Estébanez
0642f3efeb Ignore query to maximize/minimize window on Windows and X11
This makes these platform behave as MacOS in that regard and also fixes the editor window appearing in some cases even when --no-window has been passed.
2020-11-18 00:33:39 +01:00
Marcel Admiraal
e1b72e1943
Add missing javascript semi-colons.
(cherry picked from commit f42284ed07)
2020-11-17 22:25:32 +01:00
Marcus Brummer
a822bb9844
Fixed exit code retrieval of spawned processes on Windows
Use GetExitCodeProcess() on Windows to retrieve the exit code of a process in
OS:excute()

(cherry picked from commit f0f4220b05)
2020-11-17 12:07:02 +01:00
Connor Lirot
1e01963d29
Fix for linux joypad D-pad zeroing
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**

(cherry picked from commit dd021099ff)
2020-11-17 12:07:01 +01:00
Vaughan Ling
7a9660e8d2
Change android orientations from sensor to user
# Conflicts:
#	platform/android/java/lib/src/org/godotengine/godot/GodotIO.java

(cherry picked from commit d658063833)
2020-11-17 12:01:59 +01:00
Fredia Huya-Kouadio
566835e181
Update the logic to query for the 'scons' command executable path.
(cherry picked from commit 46cc3233d8)
2020-11-17 12:01:59 +01:00
Marcus Brummer
75f33fddab
Added the .jks file extension as valid preset for Android keystore files
(cherry picked from commit e1b9be4a6b)
2020-11-17 12:01:59 +01:00
Sergey Minakov
4991872305 iOS: Implement pluggable application delegate. 2020-11-15 14:27:07 +03:00
Rémi Verschelde
c36a755472
Merge pull request #43022 from Klowner/3.2-android-display-orientation
Implement OS.get_screen_orientation() for Android
2020-11-15 09:39:29 +01:00
Rémi Verschelde
b6d76c9d34
Merge pull request #43525 from m4gr3d/address_new_custom_build_logic_issues_3_2
[3.2] Address new custom build logic issues
2020-11-14 22:59:26 +01:00
Fredia Huya-Kouadio
380022637e Add missing zip alignment step for generated apks. 2020-11-14 13:16:56 -08:00
Fredia Huya-Kouadio
e87ee41fd4 Fix issue causing Export all to fail. 2020-11-14 13:16:56 -08:00
Fredia Huya-Kouadio
adf2b36179 Clear unneeded assets when generating an apk expansion.
Clean up export wording to account for the different export formats.
2020-11-14 13:16:08 -08:00
Fredia Huya-Kouadio
c9b5e912dd Remove duplicate Android orientation settings. 2020-11-13 12:18:37 -08:00
Mark Riedesel
92ff6c5164 Implement OS.get_screen_orientation() for Android 2020-11-13 10:14:06 -05:00
thebestnom
8405f1225e [3.2] Android: Keyboard modifier and arrow key support 2020-11-13 15:10:17 +02:00
Rémi Verschelde
adf2dabbde
Merge pull request #43456 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 7th batch
2020-11-11 22:33:31 +01:00
Rémi Verschelde
941e2f2ff3
Merge pull request #43454 from Faless/js/3.x_audio_worklet
[3.2][HTML5] Port inline JS code to libraries, AudioWorklet support.
2020-11-11 15:31:10 +01:00
unknown
31cdf8d9b4
Use LONG instead of DWORD (unsigned int) when interacting with DIJOFS constants.
(cherry picked from commit 4a6e53b3c9)
2020-11-11 15:30:57 +01:00
Fredia Huya-Kouadio
835d4535b7
Add a separate nativeSrcsConfigs module to handle Android Studio constraints for native code editor support.
(cherry picked from commit edf762fba6)
2020-11-11 15:30:56 +01:00
Fredia Huya-Kouadio
3b547457d7
Update the gradle plugins
(cherry picked from commit aff7cf4390)
2020-11-11 15:30:55 +01:00
Ev1lbl0w
f279f657a5
Changed path behaviour for Windows
(cherry picked from commit 525a5be01d)
2020-11-11 15:30:55 +01:00
Hugo Locurcio
4907911bf8
Remove debug_symbols=full in favor of debug_symbols=yes
`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.

(cherry picked from commit ff1f0d2cb5)
2020-11-11 15:12:01 +01:00
Fabio Alessandrelli
6d939b72f0 [HTML5] AudioWorkletAPI implementation.
Rewrote AudioDriverJavaScript to support multiple processor nodes.
The old (and deprecated) ScriptProcessorNode when threads are not
available, and the new AudioWorklet API when threads are enabled.

The new implementation uses two ring buffers and a shared state to
communicated with the AudioWorklet thread.

The audio.worklet.js JavaScript file is always added to the export
template, but only really used (and download) in the thread build.
2020-11-10 11:05:15 +01:00
Fabio Alessandrelli
e52ed6d89e [HTML5] Port JavaScript inline code to libraries.
The API is implemented in javascript, and generates C functions that can
be called from godot.
This allows much cleaner code replacing all `EM_ASM` calls in our C++
code with plain C function calls.
This also gets rid of few hacks and comes with few optimizations (e.g.
custom cursor shapes should be much faster now).
2020-11-10 10:56:13 +01:00
Pedro J. Estébanez
3ec62c82a3 Implement no-window mode for X11 and MacOS
Bonus: Homogeinize and improve OS::alert() for no-window mode
2020-11-09 20:56:12 +01:00
Fabio Alessandrelli
a7ecb3c048 [HTML5] Update syntax for lto. 2020-11-06 18:23:08 +01:00
Fabio Alessandrelli
f39b46f7c1 [HTML5] Fix audio buffer size and latency hint.
The size of the audio buffer was incorrectly doubled when creating the
script processor.
latencyHint is expressed in seconds, not milliseconds.
Additionally, on some browsers it actually affect the performance and
stability of the audio driver.
For this reason it has been completely disabled (interactive) and a not
has been left for future reference.
2020-11-06 15:38:08 +01:00
thebestnom
191c84f952 Android: Mouse Implementation
Implement mouse
Move touch to inputManager
Change to use android/input.h
2020-10-30 15:23:29 +02:00
PouleyKetchoupp
4ccde80d9d
Release .build_version file handle in Android custom build export
(cherry picked from commit b271315bac)
2020-10-28 15:09:13 +01:00
Ev1lbl0w
f41cc7d644
Changed shell_open behaviour
(cherry picked from commit 9e57a395cf)
2020-10-28 14:05:41 +01:00
Mark Riedesel
5740bd808a
Fix android apk contents having mtime 1 month in future
minizip documentation describes tm_mon as expecting the number of months
since January - [0, 11], but the month returned by OS.get_date() is in
the range of [1, 12].

(cherry picked from commit 5fe902244a)
2020-10-28 14:05:40 +01:00
Mark Riedesel
2bec10fd1c Implement OS.get_window_safe_area() for Android 2020-10-27 11:52:20 -04:00
bruvzg
df6ea27ab3
[3.2] Disable iOS SDK version check on osxcross.
Currently, osxcross `xcrun` supports only macOS SDKs.
2020-10-21 07:56:05 +03:00
Rémi Verschelde
3b4005026d
Merge pull request #42593 from bruvzg/ios_sdk_ver_check
[3.2] Add iOS SDK version check.
2020-10-20 15:12:59 +02:00
Rémi Verschelde
0181819339
Merge pull request #42773 from bruvzg/macos_inertia_32
[macOS, 3.2] Suppress momentum scrolling after key press.
2020-10-20 15:11:02 +02:00
Rémi Verschelde
e78fbd94e5
Merge pull request #42852 from naithar/fix/in-app-store
[3.2] [iOS] InAppStore fixes
2020-10-20 15:09:41 +02:00
Rémi Verschelde
04fb41a0f3
Merge pull request #42531 from BastiaanOlij/add_get_native_handle
Add get native handle
2020-10-20 13:27:07 +02:00
Bastiaan Olij
1ea7358405 Add get_native_handle to OS 2020-10-20 20:23:37 +11:00
unknown
ae75e7d8f9
Fixed an issue in UWP export caused by duplicate entry for extensions in content types file.
(cherry picked from commit 9cb46ed4e7)
2020-10-19 16:09:59 +02:00
Rémi Verschelde
f33ca5444a
SCons: Refactor and cleanup warnings definition
(cherry picked from commits 97f116d36b
and 56f3aba7b2)
2020-10-19 16:09:59 +02:00
Sergey Minakov
b07877cd27 iOS: fix in app store
Enforce strong reference for SKRequests and delegate objects for transactions to work correctly
2020-10-16 15:51:12 +03:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
Fabio Alessandrelli
a3179aa8fc Disable WebGL2, window maximize in editor builds. 2020-10-14 12:32:35 +02:00
Fabio Alessandrelli
0452c2fced Improve Project Manager video driver selection.
Now suggests the current video driver instead of defaulting to GLES3.
2020-10-14 12:32:35 +02:00
Fabio Alessandrelli
55f04952c5 [HTML5] Add JavaScriptToolsEditorPlugin.
A new editor plugin, specific to HTML5, that provide some extra features
needed to make the editor usable on that platform.

For now, it adds a "Download project sources" option in the "Tool" menu,
so the user can download the work done as a zip file (from the browser
storage).
2020-10-14 11:20:20 +02:00
Fabio Alessandrelli
294e9752bd Add JavaScript editor html file. 2020-10-14 11:20:20 +02:00
Fabio Alessandrelli
1bfc582633 [HTML5] Close IDBFS database on exit.
This should be made available in emscripten in a decent way.
Possibly after unmount, to free the database lock and allow performing
operations on it from javascript after the Emscripten Runtime has
exited.
2020-10-14 11:18:41 +02:00
Fabio Alessandrelli
47e82bcb58 [HTML5] Expose request_quit via Engine class.
So it can be called when closure compiler is enabled.
2020-10-14 11:17:08 +02:00
Fabio Alessandrelli
f72bbc4c3b Increase HTML5 THREADPOOL size.
This fixes a "random" deadlock when quitting the editor.
I still haven't figure out the root cause, but having a bigger seems to
greatly mitigate the issue.
The new pool size (pre-allocated threads) is now 8.
2020-10-14 11:17:03 +02:00
bruvzg
6ea9ee563a
[macOS, 3.2] Suppress momentum scrolling after key press or modifier change to prevent unexpected change of action. 2020-10-13 19:05:05 +03:00
PouleyKetchoupp
de4a1d09b0 Fix issues with Linux clipboard
Backport for X11 Display Server fixes on 3.2 branch.

1. Implement SAVE_TARGETS mechanism

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

2. Implement INCR mechanism

Allows pasting from x11 clipboard to receive data incrementally, which
is required when handling data size > 256KB.
2020-10-10 10:56:52 +02:00
Rémi Verschelde
4040cd350d
Merge pull request #42582 from naithar/feature/3.2-arc-refactor
[3.2] [iOS] Port 4.0 changes
2020-10-07 21:17:01 +02:00
bruvzg
d44bc8d5bc
[3.2] Add iOS SDK version check. 2020-10-06 11:33:52 +03:00
Sergey Minakov
5d1284204d iOS: port ARC support 2020-10-06 00:23:25 +03:00
Sergey Minakov
2bdfec2418 iOS: Refactor platform code
Change project structure to be more like 4.0
Refactor and remove old code as followup after deprecations fix
2020-10-06 00:23:09 +03:00
Fabio Alessandrelli
2d5f9c53b0
[HTML5] Scons now expects "emcc" to be in PATH.
No longer parse emscripten/emsdk config to detect emcc/node paths.
Use WhereIs to find "emcc" and "node", look for "node_modules" in "emcc"
path.

(cherry picked from commit 7998745237)
2020-10-04 20:54:56 +02:00
Fabio Alessandrelli
61d4b8045c [HTML5] Run Audio process in thread when available
This should fix some of the audio stuttering issues when the HTML5
export is compiled with threads support.
The API should be ported to AudioWorklet to (hopefully) be perfect.
That though, cannot be backported to 3.2 due to extra restriction of
AudioWorklet (which only runs in SecureContext, and needs a polyfill for
Safari).
2020-10-02 16:25:19 +02:00
Fabio Alessandrelli
a57bd798cd Add extra suffix for HTML5 thread builds. 2020-10-02 16:25:18 +02:00
Fabio Alessandrelli
0ca7bc374e Add COOP/COEP headers to HTML5 "run" server.
This allow the page to be considered a SecureContext if the address is
localhost (127.0.0.1/::1) and let Firefox (and future Chrome versions)
enable extra features needed for the HTML5 threaded export.
2020-10-02 16:25:18 +02:00
Rémi Verschelde
7ef6aa7342
Merge pull request #42266 from Faless/js/3.0_sync_fs_size_handlers
[3.2] [HTML5] Synchronous main, better persistence, handlers fixes, optional full screen.
2020-10-02 16:23:35 +02:00
Rémi Verschelde
014147e511
Merge pull request #40557 from PoqXert/game-center
iOS Game Center improvements
2020-10-02 10:58:14 +02:00
Rémi Verschelde
e35687a116
Merge pull request #42478 from bruvzg/macos_dpi_32
[3.2] Fix `get_screen_dpi` on macOS.
2020-10-01 23:03:28 +02:00
bruvzg
610728c9f1
[3.2] Fix get_screen_dpi on macOS for non fractional display scales and update documentation. 2020-10-01 22:55:54 +03:00
Rémi Verschelde
dbb1df2acc
Merge pull request #42459 from naithar/ios-warnings-3.2
[3.2] [iOS] Fix compilation warnings and deprecated API
2020-10-01 19:12:23 +02:00
Rémi Verschelde
1815a90796
Merge pull request #42466 from nekomatata/x11-events-mutex-leak
[3.2] Fix leak with events mutex in OS_X11
2020-10-01 19:10:30 +02:00
Poq Xert
ea5833fc4c iOS GameCenter: Add authenticate method
And no longer connect automatically.
2020-10-02 01:20:11 +10:00
Sergey Minakov
3386fac02c iOS: fix deprecations
Change deprecated method calls to new ones.
Guard iOS version dependant functionality behind availability checks.
2020-10-01 18:09:55 +03:00
PouleyKetchoupp
936c701838 Fix leak with events mutex in x11 Display Server 2020-10-01 16:16:23 +02:00
Rémi Verschelde
4ad74609ce
Merge pull request #40205 from bruvzg/click-through-3
[3.2] Add mouse event pass-through support for window.
2020-10-01 13:58:24 +02:00
Rémi Verschelde
0c3e0ab194
Merge pull request #40994 from qarmin/sanitization32
[3.2] Added Linux sanitizer with xvfb to github workspace
2020-10-01 13:56:09 +02:00
Rémi Verschelde
58f5b25340
Merge pull request #41173 from naithar/fix/iphone-os-values-3.2
[iOS] [3.2] Simplify OS values retrieval
2020-10-01 13:09:36 +02:00
Sergey Minakov
42de81e235 iOS: move touch delay to settings 2020-10-01 12:36:57 +03:00
Rémi Verschelde
904773149d
Merge pull request #42341 from nekomatata/x11-events-thread-3.2
[3.2] Fix issues related to delay when processing events on Linux
2020-09-30 16:39:55 +02:00
Haoyu Qiu
7840a550b5
Hides special folders in FileDialog for macOS
(cherry picked from commit 1998f78679)
2020-09-29 13:57:58 +02:00
Bartłomiej T. Listwon
858bdbacfd
Add all headers to VS Project
(cherry picked from commit 317c2b194d)
2020-09-29 13:57:56 +02:00
Fredia Huya-Kouadio
91a1e4c9ee Fix splash screen loading on Android 2020-09-28 11:24:02 -07:00
Rémi Verschelde
8ca9680b13
Merge pull request #38076 from DrMoriarty/fix_pvrtc
iOS: Fix multiple issues with PVRTC import, disable ETC1
2020-09-28 10:17:22 +02:00
Rémi Verschelde
ec01d6f25e
Merge pull request #42328 from bruvzg/3_mac_captured_fix
[macOS, 3.2] Fix mouse position in captured mode.
2020-09-28 10:08:16 +02:00
Rémi Verschelde
fc50d5b38c
Merge pull request #42186 from m4gr3d/3.2-android-subview
[3.2] Godot Android Subview Implementation
2020-09-27 20:05:33 +02:00
PouleyKetchoupp
f725d9cb73 Fix issues related to delay when processing events on Linux
3.2 backport of PR #41910:
Fix general keyboard input lag on X11 display server
Fix delay to process clipboard content from Godot in other programs
2020-09-26 15:32:40 +02:00
bruvzg
df5499fedf
[macOS, 3.2] Fix mouse position in captured mode. 2020-09-25 08:54:30 +03:00
Vasiliy Makarov
f388ea00bf iOS: Fix multiple issues with PVRTC import, disable ETC1
Fixes: #28683, #28621, #28596 and maybe others

For iOS we enable pvrtc feature by default for both GLES2/GLES3
Etc1 for iOS doesn't have any sense, so it disabled.
Fixed checks in export editor.
Fixed pvrtc ability detection in GLES2 driver.
Fixed pvrtc encoding procedure.
2020-09-23 11:13:50 +02:00
Fabio Alessandrelli
35fcc1835c JS synchronous start, better persistent FS sync.
The engine now expects to emscripten FS to be setup and sync-ed before
main is called. This is exposed via `Module["initFS"]` which also allows
to setup multiple persistence paths (internal use only for now).

Additionally, FS syncing is done **once** for every loop if at least one
file in a persistent path was open for writing and closed, and if the FS
is not syncing already.

This should potentially fix issues reported by users where "autosave"
would not work on the web (never calling `syncfs` because of too many
writes).
2020-09-19 18:27:21 +02:00
Fabio Alessandrelli
e7d00d08f5 Make canvas resize optional in HTML5. 2020-09-19 18:27:21 +02:00
Fabio Alessandrelli
40f73f74ce Better HiDPI support in HTML5. 2020-09-19 18:27:21 +02:00
Fabio Alessandrelli
afb81abae5 Window event listener do not use capture. 2020-09-19 18:27:21 +02:00
Fabio Alessandrelli
c0e0247f39 Small refactor to JavaScript handlers.
Crated helper class in native/utils.js.
Simplify code in OS/DisplayServer.
2020-09-19 18:27:21 +02:00
Fredia Huya-Kouadio
8d9733f90c Add overridable init method for the Godot fragment instance. 2020-09-18 16:45:46 -07:00
Fredia Huya-Kouadio
e99dc65b64 Enable the ability to use Godot as a subview within an Android app
(cherry picked from commit 920639511d)
2020-09-18 16:45:40 -07:00
Aman Jain
59da1db188 Add 'Export App Bundle' to Android Export Options 2020-09-18 16:38:30 -07:00
Aman Jain
654342d3bf refactor apk signing into it's own method 2020-09-18 16:17:31 -07:00
Aman Jain
452af201b0 Write an AndroidManifest.xml file to be merged with app module's manifest. 2020-09-18 16:17:31 -07:00
Aman Jain
a323a1eacd Added methods to copy project icon files to Gradle project 2020-09-18 16:17:31 -07:00
Aman Jain
ee9127bd20 Create strings.xml files to mimic behavior of _fix_resources method 2020-09-18 16:17:27 -07:00
Aman Jain
824f0b0569 Refactored permissions and command line flags into separate methods 2020-09-18 16:12:15 -07:00
Aman Jain
29a71edd76 Utility methods for writing files to Gradle project. 2020-09-18 16:12:15 -07:00
Fabio Alessandrelli
c610ad3739 Move request_quit to javascript_main. 2020-09-18 18:54:11 +02:00
Rémi Verschelde
c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 14:09:51 +02:00
Rémi Verschelde
8b5061aae7
X11: Try to load libXrandr.so.3 if libXrandr.so.2 isn't found
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.

(cherry picked from commit 413ff7938d)
2020-09-18 11:56:42 +02:00
Rémi Verschelde
cb78a5d7ae
Linux/BSD: Fix support for NetBSD
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.

(cherry picked from commit 5f4d64f4f3)
2020-09-18 10:29:52 +02:00
bruvzg
e51fed9d1b
[3.2] Add window click-through support. 2020-09-17 12:36:01 +03:00
Rémi Verschelde
6b5102cf90
Merge pull request #41504 from naithar/fix/analyzer-3.2
[3.2] [iOS] Leaks and deprecations fix
2020-08-25 18:37:02 +02:00
Sergey Minakov
f81c6c52fc iOS: fix deprecations and leaks
Fixes some deprecations and leaks reported by Xcode Analyzer
2020-08-25 17:17:17 +03:00
Rémi Verschelde
2a692f41a3
Merge pull request #41364 from m4gr3d/fix_textedit_movement_bug_3_2
Fix issue causing the textedit to move upward
2020-08-21 02:25:25 +02:00
Rémi Verschelde
9bf5a0b791
Merge pull request #41081 from naithar/feature/ios-framework-import-3.2
[iOS] [3.2] Export: Add a method to embed a framework
2020-08-19 14:11:27 +02:00
Sergey Minakov
910c554a1a iOS Export: Add a method to embed a framework
By default 'add_ios_framework' would not embed a framework to save previous behavior.
New 'add_ios_embedded_framework' would embed framework on export.
2020-08-19 14:54:59 +03:00
Fredia Huya-Kouadio
a8240f7351 Fix issue causing the textedit to move upward 2020-08-18 17:05:23 -07:00
bruvzg
2b996cca67
[Windows] Fix modifier keys when using tablet input. 2020-08-17 14:43:23 +03:00
Gordon MacPherson
c1a5e9f513 fixed linker being slow on OSX
(cherry picked from commit 788c521ce8)
2020-08-17 11:05:53 +02:00
bruvzg
2b1cfad591
[macOS] Fix "on top" not set on init, and reseting on window update. 2020-08-15 18:05:59 +03:00
Rafał Mikrut
abd7c1833e Added Linux sanitizer with xvfb to github workspace 2020-08-14 12:15:58 +02:00
Andreas Haas
abdcb7d299 DirectInput: use correct joypad id
Previously `joypad_count` was used as the index into the d_joypads array when initializing a new gamepad.
This caused the accidental override of an already connected device when a gamepad with a lower id was disconnected and connected again.

fixes #17566

(cherry picked from commit 802a0316c5)
2020-08-14 00:32:05 +02:00
Christopher Davis
f19bab5165 platform: Update metadata for export platforms
Updates the logos of for macOS, Android, and iOS.

Addresses https://github.com/godotengine/godot-proposals/issues/1161

(cherry picked from commit 41d8c0c818)
2020-08-14 00:32:05 +02:00
Rémi Verschelde
5972495d99 Revert "Virtual keyboard size adjustment fixes"
Also reverts "[3.2] Move PopupWindow logic to GodotEditText on Android".

This reverts commits 69db38742f and.
ff0ada164b.
2020-08-14 00:32:04 +02:00
Sergey Minakov
8a8f0a3b79 iOS: simplify OS values retrieval 2020-08-10 16:21:42 +03:00
Rémi Verschelde
c49be9bf84
Merge pull request #40791 from nekomatata/android-keyboard-cleaning-3.2
[3.2] Move PopupWindow logic to GodotEditText on Android
2020-07-31 13:00:50 +02:00
PouleyKetchoupp
ff0ada164b [3.2] Move PopupWindow logic to GodotEditText on Android 2020-07-28 21:03:55 +02:00
Fabio Alessandrelli
31c21b9750 Implement HTML5 cancel/ok button swap on Windows.
Platform is detected on init via the `navigator.platform` string.

(cherry picked from commit 0b286a287c)
2020-07-28 00:55:46 +02:00
bruvzg
a2f034d3ab [macOS] Refocus last key window after DisplayServer::alert is closed.
(cherry picked from commit a05776e20d)
2020-07-28 00:45:06 +02:00
Rémi Verschelde
4b9bb50176 Style: Fix code format scripts compat with non-GNU Unices
It's too hard to get compatibility between GNU and BSD sed,
so let's just use perl oneliners.

And improve it to also remove trailing tabs, not just spaces.

(cherry picked from commit c71e189efd)
2020-07-28 00:41:52 +02:00
Rémi Verschelde
37bac7d75d
Merge pull request #40672 from nekomatata/virtual-keyboard-height-fix-3.2
[3.2] Virtual keyboard size adjustment fixes
2020-07-27 08:57:52 +02:00
Rémi Verschelde
a2edf04fd2
Merge pull request #40469 from nekomatata/virtual-keyboard-enter-fixes-3.2
[3.2] Fix Return key events in LineEdit & TextEdit on Android
2020-07-26 20:26:02 +02:00
Rémi Verschelde
db6d7499c0
Merge pull request #40723 from naithar/fix/ios-touch-events-master-3.2
[3.2] Fix for iOS touch recognition
2020-07-26 15:42:59 +02:00
Sergey Minakov
16f9ff5866 iOS: added delay gesture recognizer
This gesture recognizer will prevent GLView from processing unwanted gestures.
Emulates UIScrollView behavior
Fires delayed touches on significant movement
2020-07-26 15:49:09 +03:00
PouleyKetchoupp
69db38742f Virtual keyboard size adjustment fixes
1. Disable virtual keyboard focus adjustment on Android
The default adjustment setting was causing the view to pan down in order
to adjust the focus on the text content.
We don't need any focus adjustment since we're using a fixed size window
for our application.
Documentation:
https://developer.android.com/reference/android/view/WindowManager.LayoutParams#SOFT_INPUT_ADJUST_NOTHING

2. Fix virtual keyboard height regression
Disabling virtual keyboard focus adjustement caused get_keyboard_height
to always return 0 because it was calculated when the view is resized.
In order to fix it, a PopupWindow is now created on top of the main view
and is set for focus adjustments so the keyboard size can be calculated
based on this popup without affecting the main view.
2020-07-24 18:26:20 +02:00
Rémi Verschelde
b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
Rémi Verschelde
f1cdb91f34 SCons: Remove unused DEBUG_MEMORY_ENABLED define
Its last use was removed in Godot 3.0, so it no longer makes sense to define.

Also removed `D3D_DEBUG_INFO` for Windows as it's likely a left over from a
long time ago pre-opensourcing when Godot had some form of Direct3D 9 support?

(cherry picked from commit dcf902df85)
2020-07-24 10:31:57 +02:00
Zae
6f2be6b05c [3.2] fix crlf for clipboard 2020-07-20 15:42:32 +08:00
PouleyKetchoupp
c0b394572f Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.

Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.

Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.

Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
2020-07-17 18:25:40 +02:00
Fabio Alessandrelli
e7099ed2ea Fix setenv not defined in older emscripten verions. 2020-07-15 22:21:47 +02:00
bruvzg
26a825aac3
[macOS, 3.2] Fix window size on macOS Big Sur (title bar height is no longer same as menu height), use top-left corner as resize origin instead of bottom-left. 2020-07-14 17:38:16 +03:00
Rémi Verschelde
0246a1a276 Revert "Enable the ability to use Godot as a subview within an Android app"
This reverts commit 920639511d.

The changes are good, this revert is only done for release management reasons
as we want this feature to get more testing before making it in a stable build,
but a 3.2.3 release is imminent to handle some regressions in 3.2.2.

This will be re-committed in a 3.2-based feature branch, and we'll merge it
again once we're confident about it (probably for 3.2.4).
2020-07-10 08:51:21 +02:00
Rémi Verschelde
6fd712c874
Merge pull request #40173 from naithar/feature/ios-storyboard-usage
[3.2] [iOS] Option to use storyboards for launch screens.
2020-07-09 08:36:07 +02:00
Sergey Minakov
a4028b99ec iOS Export: use relative path for res:// files
(cherry picked from commit 7b64f2df50)
2020-07-08 09:01:58 +02:00
bruvzg
e9ab41b71d
[macOS, 3.2] Implement seamless display scaling. 2020-07-07 22:54:33 +03:00
Sergey Minakov
6264c5146c iOS Export: Storyboard custom values 2020-07-07 02:12:50 +03:00
Sergey Minakov
46c6383c8d iOS Export: add option to use storyboard for launch screen 2020-07-07 00:01:35 +03:00
Daniel Ting
3f5f58b9d8 Fix opening URLS with special characters in macOS
The Online Tutorials section of InputMap in the editor's built-in
documentation viewer contains this link:

docs.godotengine.org/en/latest/tutorials/inputs/inputevent.html#inputmap

The macOS implementation for opening a link percent-encodes it before
sending it to the browser, resulting in a 404. This is to fix #13422
where filenames with special characters could not be opened in Finder.
However, this breaks URLS so I added a check to see if the resource
scheme is file:// and if so, only then is it escaped. This allows other
schemes like `http`, `ftp`, and `mailto` to be used.

(cherry picked from commit b8e6ff9a7f)
2020-07-06 14:18:18 +02:00
bruvzg
14b8124074 [macOS export] Set correct external file attributes (Unix mode), and creation time.
(cherry picked from commit accae11fe3)
2020-07-03 13:17:57 +02:00
Rémi Verschelde
24f527b561
Merge pull request #39996 from naithar/feature/ios-gdnative
[3.2] Add support of iOS's dynamic libraries to GDNative
2020-07-03 07:48:45 +02:00
Rémi Verschelde
a3e525ba0f
Merge pull request #40054 from bruvzg/macos_confined_mouse_mode_3
[macOS, 3.2] Implement confined mouse mode.
2020-07-03 00:11:27 +02:00
bruvzg
b233cb640d
[macOS, 3.2] Implement confined mouse mode. 2020-07-02 17:12:16 +03:00
Fabio Alessandrelli
357e99a31e Use dummy driver when JS AudioContext is unavailable. 2020-07-02 14:30:23 +02:00
Fabio Alessandrelli
399e2c1db0 Limit FPS in JS by skipping iterations. 2020-07-02 14:30:23 +02:00
Fabio Alessandrelli
c7d2767ab9 [JS] Check canvas size each loop, force redraw.
Remove ResizeObserver, fix compatibility issues, achieve smoother
resizing.
2020-07-02 14:30:23 +02:00
Fabio Alessandrelli
093c463ebf [HTML5] Early FS initialization.
So that "/userfs" is created and mounted before `setup`.
2020-07-02 14:30:12 +02:00
Sergey Minakov
e2a45fe840 iOS Export: Updated Info.plist. Framework embedding. Fixes for search paths 2020-07-02 12:46:57 +03:00
Sergey Minakov
519024829a iOS Export: turn .dylib into .framework on export 2020-07-02 12:45:14 +03:00
Rémi Verschelde
b833296cbb
Merge pull request #39943 from bruvzg/macos_apple_silicon_3
[macOS, 3.2] Add support for the Apple Silicon (ARM64) build target.
2020-06-29 15:30:03 +02:00
bruvzg
43888ebfaf
[macOS, 3.2] Add support for the Apple Silicon (ARM64) build target. 2020-06-29 14:43:29 +03:00
Rémi Verschelde
08ee1de535 X11: Ensure XGetWindowProperty data gets freed
Fixes a small memory leak reported by lsan:
```
Direct leak of 73 byte(s) in 1 object(s) allocated from:
    #0 0x7f29825f3e70 in malloc (/lib64/liblsan.so.0+0xee70)
    #1 0x7f29824a5729 in XGetWindowProperty (/lib64/libX11.so.6+0x29729)
```
2020-06-29 13:05:24 +02:00
Fredia Huya-Kouadio
623a1ae5b3 Fix the logic to enable focus awareness 2020-06-27 16:40:22 -07:00
Rémi Verschelde
28c0088d86
Merge pull request #39558 from m4gr3d/godot_fragment_3_2
[3.2] Enable the ability to use Godot as a subview within an Android app
2020-06-26 22:07:43 +02:00
Rémi Verschelde
34c5133e6a
Merge pull request #39604 from Faless/js/3months_backport
[HTML5 - 3.2] Backport most changes/improvement in master.
2020-06-26 20:50:58 +02:00
Fredia Huya-Kouadio
920639511d Enable the ability to use Godot as a subview within an Android app 2020-06-25 19:57:03 -07:00
Fredia Huya-Kouadio
944210923f Follow up cleanup for the godotpayment project module
(cherry picked from commit 206cbd960b)
2020-06-24 22:52:05 +02:00
Rémi Verschelde
8f28e0861f
Merge pull request #39762 from naithar/feature/ios-modules
Enable iOS modules and fix missing symbols errors (3.2)
2020-06-24 22:50:05 +02:00
Poq Xert
bd71925726 Updated purchase receipt suitable for sending to apple verification server 2020-06-24 17:34:20 +10:00
Sergey Minakov
e564ca0c1b Export: Fix iOS enabling push notifications capability 2020-06-22 23:16:22 +03:00
Sergey Minakov
a678ceaeae SCons: Enable modules for iOS 2020-06-22 23:15:52 +03:00
bruvzg
a662b853dd Fix use uninitialized ofs variable introduced in 39701.
(cherry picked from commit 439c97e0ff)
2020-06-22 15:41:36 +02:00
bruvzg
1468c0b4d4 [Windows] Prevent overwriting old cursor handle on multiple mouse_mode changes, ensure mouse_mode is set before cursor_set_shape is called to restore cursor.
(cherry picked from commit fc1d1c3557)
2020-06-22 13:08:53 +02:00
Rémi Verschelde
f2f11bc752
Merge pull request #39744 from timoschwarzer/remove-godot-payment-plugin
Remove GodotPayment android plugin (3.2)
2020-06-22 12:15:36 +02:00
bruvzg
e2675e9462 macOS, prevent multiple CGDisplayHideCursor calls unpaired with CGDisplayShowCursor.
(cherry picked from commit 7a250b579f)
2020-06-22 12:04:31 +02:00
Timo Schwarzer
5053ab684a
Remove GodotPayment android plugin
This is now available in a separate repository
at https://github.com/godotengine/godot-google-play-billing
2020-06-22 11:11:41 +02:00
Rémi Verschelde
8ac13e50cf Move Haiku platform port to external repository
The Haiku port now resides at:
https://github.com/godotengine/godot-haiku-platform

While we're happy to support as many Free and Open Source platforms as we can,
we need to put the main focus on the platforms that we can reasonably maintain,
and for Haiku we have been lacking maintainers ever since the port was first
merged in 2015.

The Haiku code has not been compiling and much less working at least since the
release of Godot 3.0, and while some attempts have been made at fixing things,
it's still not functional today in the `3.2` branch (and much less in `master`,
understandably).

Having it in an external repository should hopefully enable Haiku contributors
to fix issues in their own time, and possibly tag versions compatible with
past Godot releases once they are ready.

(cherry picked from commit efcc508ee5)
2020-06-21 21:42:26 +02:00
Bastiaan Olij
70fb79efa0 Fix missing slider joystick handling on Windows
(cherry picked from commit aa01b327d6)
2020-06-21 21:41:14 +02:00
PouleyKetchoupp
cdbbc75e90 Set proper file type attribute for OSX zip export
The missing file type in file attributes was causing the file to lose
executable permissions when unzipped with some softwares.

(cherry picked from commit 4501771fd8)
2020-06-21 21:40:57 +02:00
Rémi Verschelde
f99cbb94cc Export: Rename 'Windows Universal' to 'UWP'
It's otherwise too easy to be confused between 'Windows Desktop' (Win32)
and 'Windows Universal' (UWP).

(cherry picked from commit 08ef0aab16)
2020-06-21 21:39:44 +02:00
unknown
d080c0de51 adding check for syskeydown on control and alt
(cherry picked from commit d191a8b9f8)
2020-06-21 21:34:50 +02:00
Ev1lbl0w
4d7ac36e84 Allow Godot to kill it's own PID
(cherry picked from commit 75ce45440a)
2020-06-18 11:29:28 +02:00
Fabio Alessandrelli
b146bf2528 Canvas resize callback, to update buffer size. 2020-06-18 09:21:14 +02:00
Fabio Alessandrelli
21c9f37757 [HTML5] Refactor JS, threads support, closures.
- Refactored the Engine code, splitted across files.
- Use MODULARIZE option to build emscripten code into it's own closure.
- Optional closure compiler run for JS and generated code.
- Enable lto support (saves ~2MiB in release).
- Can now build with tools=yes (not much to see yet).
- Dropped some deprecated code for older toolchains.
- Add onExit, and onExecute JS function.
- Add files drag and drop support.
- Add support for low precessor usage mode (via offscreen render, swap).
2020-06-18 09:21:14 +02:00
Rémi Verschelde
7f6767470d
Merge pull request #39580 from m4gr3d/provide_activity_to_godot_plugin_constructor_3_2
Clean up the GodotPlugin public API.
2020-06-16 20:45:49 +02:00
Fredia Huya-Kouadio
61aa477e1c Clean up the GodotPlugin public API. 2020-06-16 09:24:41 -07:00
Aaron Franke
01061c6fbb Simplify some code in platform/uwp/export
(cherry picked from commit 068054002d)
2020-06-15 14:34:35 +02:00
Rémi Verschelde
50c4834548
Merge pull request #39502 from bruvzg/kbd_layouts_3
[3.2] Add keyboard layout enumeration / set / get functions.
2020-06-15 11:11:08 +02:00
Fabio Alessandrelli
1c0abd6393 Use 2-phase setup in JavaScript.
Make the first iteration as soon as the canvas is setup, avoiding a
black screen before the next animation frame is requested.
Also create OS and do setup before syncing FS to avoid crash when IDBFS
access is denied.
2020-06-14 15:43:18 +02:00
bruvzg
2256946f79
[3.2] Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11). 2020-06-13 11:01:49 +03:00
lawnjelly
b330766c30 Fix overflow condition with QueryPerformanceCounter
The previous code for OS_Windows::get_ticks_usec() multiplied the tick count by 1000000 before dividing by ticks_per_second. The ticks is counted in a 64 bit integer and is susceptible to overflow when a machine has been running for a long period of time (days) with a high frequency timer.

This PR separates the overall calculation into one for seconds and one for the remainder, removing the possibility of overflow due to the multiplier.

(cherry picked from commit db9fa88160)
2020-06-11 09:40:04 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Fabio Alessandrelli
8b321354d8 Swtich HTML5 key detection from keyCode to code.
The value of this, does not include the layout.
The code has extra logic to map the unicode value to our keylist,
supporting ASCII and Latin-1.

(cherry picked from commit 0a35b97b62
with help of https://github.com/Faless/godot/tree/js/keyCode)
2020-06-05 12:49:50 +02:00
Marcus Brummer
a6e9001579 Check if the specified Android release keystore exists
(cherry picked from commit 21263a65a9)
2020-06-05 12:45:46 +02:00
Fredia Huya-Kouadio
d1e4cede90 Add support for focus awareness 2020-06-04 15:51:51 -07:00
PouleyKetchoupp
aa935c262a Fix inconsistent error messages with Android custom export templates
(cherry picked from commit be22a1f9bc)
2020-06-04 12:16:39 +02:00
Marcel Admiraal
eef442f32d Update Windows GUID to SDL uid conversion.
(cherry picked from commit a833db80d9)
2020-06-04 12:09:40 +02:00
Marcel Admiraal
5dfd4fc84d Update OSX GUID to SDL uid conversion.
Co-authored-by: John Wakley <johncwakley@users.noreply.github.com>
(cherry picked from commit d04cbbd76b)
2020-06-04 12:09:40 +02:00
Marcel Admiraal
91590b0cf0 Add dinput nullptr checks.
(cherry picked from commit bc49d34123)
2020-06-04 12:09:39 +02:00
Marcel Admiraal
6c9c6885a2 Do not probe joypads if DirectInput cannot be initialized.
(cherry picked from commit 97a529b1d8)
2020-06-04 12:09:39 +02:00
Hugo Locurcio
d814352d92 Tweak the DirectInput initialization failure message
This closes #36662.

(cherry picked from commit fe09b4d2b3)
2020-06-04 12:09:39 +02:00
bruvzg
1642c4163d Ignore invalid tablet driver name, when non are available.
(cherry picked from commit ef1a305e50)
2020-06-04 12:09:39 +02:00