Commit graph

2987 commits

Author SHA1 Message Date
PouleyKetchoupp 2c4d64102a Fix general keyboard input lag on X11 display server
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.
2020-09-24 16:01:41 +02:00
Rémi Verschelde c10e8ac1de
Merge pull request #42178 from Faless/js/sync_fs_size_handlers
[HTML5] Synchronous main, better persistence, handlers fixes, optional full screen.
2020-09-23 10:14:22 +02:00
Fabio Alessandrelli dccd71c7a3 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-23 09:51:06 +02:00
Fabio Alessandrelli 53f04aa1b9 Make canvas resize optional in HTML5. 2020-09-23 09:51:06 +02:00
Fabio Alessandrelli 806edcae5b Better HiDPI support in HTML5. 2020-09-23 09:51:06 +02:00
Fabio Alessandrelli 7d0896e763 Window event listener do not use capture. 2020-09-23 09:51:06 +02:00
Fabio Alessandrelli 48aa0b5b03 Small refactor to JavaScript handlers.
Crated helper class in native/utils.js.
Simplify code in OS/DisplayServer.
2020-09-23 09:51:06 +02:00
Fabio Alessandrelli 7d045b8543 Expose request_quit method to JS in HTML5 export. 2020-09-23 09:51:06 +02:00
Fredia Huya-Kouadio 79c1cf600b Add overridable init method for the Godot fragment instance. 2020-09-18 16:59:09 -07:00
Fabio Alessandrelli 27ab97501b [HTML5] Add override keyword, cleanup methods. 2020-09-18 18:48:59 +02:00
Rémi Verschelde 3e78963bb9
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 13:44:25 +02:00
Rémi Verschelde 413ff7938d
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.
2020-09-18 11:55:12 +02:00
Rémi Verschelde 5f4d64f4f3
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.
2020-09-18 10:27:55 +02:00
bruvzg 6a14c72b12
Add window click-through support. 2020-09-17 12:36:18 +03:00
Hugo Locurcio 4df86f8b04
Only display the Windows toggle console option if it can actually be used 2020-09-14 21:52:04 +02:00
Marcel Admiraal e3d698dae9 Remove unused Python imports. 2020-09-10 11:38:52 +01:00
Marcel Admiraal 64095245ee Explicitly add implicitly added semicolons. 2020-09-09 15:30:57 +01:00
bruvzg f043eabdd8
Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
2020-09-05 14:53:39 +03:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Rémi Verschelde a77106bf7e
Merge pull request #41332 from bruvzg/win_subsys_option
Revert #41164, add subsystem build option.
2020-09-03 11:52:29 +02:00
PouleyKetchoupp eeebe6914e Fix drag and drop between windows in X11 display server
Proper implementation for get_window_at_screen_position:
Now getting the topmost last active window when overlapping.

Mouse drag & release events:
They are now propagated through the current focused window, in order to
make it consistent with the engine expectations and the Windows display
server implementation.
2020-09-03 10:31:03 +02:00
Rémi Verschelde 2a8531cc56
Merge pull request #41456 from nekomatata/x11-fix-popups
Popup fixes for X11 display server
2020-09-03 00:09:19 +02:00
Fredia Huya-Kouadio b8d5ced8cd Fix issue causing the textedit to move upward 2020-08-30 10:42:38 -07:00
Rémi Verschelde c59e9399e7
Merge pull request #41550 from godotengine/revert-40671-virtual-keyboard-height-fix
Revert "Fix virtual keyboard height regression"
2020-08-27 08:55:51 +02:00
Rémi Verschelde f98b32ff51
Merge pull request #41549 from godotengine/revert-40484-android-virtual-keyboard-adjustment
Revert "Disable virtual keyboard focus adjustment on Android"
2020-08-26 23:48:09 +02:00
Fredia Huya-Kouadio db35a008f6
Revert "Fix virtual keyboard height regression" 2020-08-26 14:38:02 -07:00
Fredia Huya-Kouadio ffd0bb1d02
Revert "Disable virtual keyboard focus adjustment on Android" 2020-08-26 13:27:25 -07:00
Fredia Huya-Kouadio 04b402b6f1
Revert "Move PopupWindow logic to GodotEditText on Android" 2020-08-26 13:24:18 -07:00
PouleyKetchoupp bb306750ce Fix WINDOW_EVENT_FOCUS_IN for popups on Windows
On Windows, WINDOW_EVENT_FOCUS_IN was never sent by the display server
for popups, because WM_ACTIVATE events are received during the call to
_update_window_style, which happened before the callbacks were set.

This was causing some issues with the way Popup is now handling closing on
parent focus.

Now _update_window_style is only called during show_window, after Window
initialized callbacks.
2020-08-26 18:14:36 +02:00
PouleyKetchoupp 5315bff002 Fix menu popups delay and focus in X11 display server
Now using override_redirect for menu & tooltip popups to prevent the WM from
interfering with them, so we have more control over focus management
and avoid a delay before they show up.
2020-08-26 18:14:07 +02:00
bruvzg 9a85948907
[macOS] Fix heap use-after-free in DisplayServer. 2020-08-25 14:04:20 +03:00
PouleyKetchoupp 2b49cb0b73 Re-apply "Fixes for windows in X11 tiling WMs"
From PR #38727 which was reverted in #41373 because of regressions in Ubuntu
with Gnome.

Co-authored-by: Lorenzo Cerqua <lorenzocerqua@tutanota.com>
2020-08-22 18:42:42 +02:00
Marcel Admiraal 5f092cf7bb Fix new black style check failures in various files. 2020-08-21 16:51:30 +01:00
Juan Linietsky 9c5c1635b2
Revert "Fixes for windows in X11 tiling WMs" 2020-08-19 12:37:59 -03:00
Rémi Verschelde 5f6368278f
Merge pull request #41080 from naithar/feature/ios-framework-import
[iOS] [4.0] Export: Add a method to embed a framework
2020-08-19 14:10:50 +02:00
Sergey Minakov 1661309d59 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:35:54 +03:00
bruvzg c76fe59204
Add Windows Subsystem build option. 2020-08-17 19:07:12 +03:00
bruvzg 03ffd6451a
Revert "[Windows] Attach to parent console instead of creating new one."
This reverts commit 4f7a49db53.
2020-08-17 19:05:48 +03:00
bruvzg ee76775792
[Windows] Fix modifier keys when using tablet input. 2020-08-17 14:43:16 +03:00
Andrii Doroshenko (Xrayez) 6f426c3360 Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from
`setup()` and `setup2()` so that `ClassDB` could be tested properly
(input, audio, rendering, physics etc, are excluded).

Display and rendering servers/singletons are not initialized at all.

Due to the fact that most subsystems are disabled, fixed various crashes in the
process (in order):
- `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while
  `register_scene_types()`);
- `make_default_theme` which depends on `RenderingServer`;
- `XRServer` singleton access while calling `register_modules_types()`;
- hidden bug in a way joypads are cleaned up (MacOS and Linux only).

Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`.

ClassDB tests:

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-08-16 16:41:02 +03:00
Rémi Verschelde d4665e7859
Merge pull request #41285 from bruvzg/macos_on_top_4
[macOS] Fix "on top" incorrectly set on init and resetting on window update.
2020-08-15 17:59:05 +02:00
bruvzg 9d1cf0b6af
Fix "on top" incorrectly set on init (all platforms).
Fix "on top" reseting on window update. (macOS).
2020-08-15 17:53:18 +03:00
Gordon MacPherson 788c521ce8 fixed linker being slow on OSX 2020-08-15 01:55:36 +01:00
Rémi Verschelde 33b2070d2e Remove obsolete GLES2 backend code
This code currently isn't compiled (and cannot compile).

We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan
(probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite
different so it's not relevant to keep this old Godot 3.2 code.

The `drivers/gles2` code from the `3.2` branch can be used as a reference for
a potential new implementation.
2020-08-13 10:04:53 +02:00
Rémi Verschelde 7e19f217bd
Merge pull request #41000 from amanj120/forward_port_bundle_pr_export
Add 'Export App Bundle' to Android Export Options
2020-08-11 19:03:40 +02:00
Rémi Verschelde 0e751ea7c3
Merge pull request #41164 from bruvzg/win_attach_console
[Windows] Attach to parent console instead of creating new one.
2020-08-11 12:58:12 +02:00
bruvzg 4f7a49db53
[Windows] Attach to parent console instead of creating new one. 2020-08-11 13:02:50 +03:00
Rémi Verschelde f2d6a4bf84
Merge pull request #40961 from BrainBlasted/update-platform-metadata
platform: Update metadata for export platforms
2020-08-11 12:02:20 +02:00
Sergey Minakov f9989a1a58 iOS: simplify OS value retrieval 2020-08-10 15:54:44 +03:00
Aman Jain 2b89944a3d Add 'Export App Bundle' to Android Export Options 2020-08-05 12:55:02 -04:00