On FocusOut events, the window could be destroyed while propagating
WINDOW_EVENT_FOCUS_OUT event, which causes the WindowData to be
invalidated, and still used for calls to XUnsetICFocus.
This change moves calls to XUnsetICFocus, and also XSetICFocus in
FocusIn events, before propagating the change of focus event to the
engine, to be safe in any case.
Also setting xic member to nullptr after all calls to XDestroyIC to keep
things clean and consistent.
Fixes#42645
We want debug builds to have a console and easy stdout redirection by default.
Windows makes reading the stdout/stderr stream from gui applications too cumbersome
(and most users don't know about it, and just wonder why they don't see a thing).
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).
Enabled ARC for iOS.
Weakify/Strongify macros for objc blocks.
Removed old version checks.
Specific types for ObjC++ modules to exclude unneeded bridging.
Separate DeviceMetrics class for device specific data.
Replaced old/deprecated functionality.
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.
When pasting clipboard content from Godot to other applications,
multiple SelectionRequest events are sent to Godot in order to access
the data. It could take a long time before the data is ready for the
other app because events were processed one by one on the main thread,
especially when Godot is unfocused and runs at low frequency.
With this change, SelectionRequest events are directly handled on the
separate event polling thread to minimize this delay.
This change also replaces clipboard_get() calls in SelectionRequest with
a direct access to internal_clipboard, since in this case we know Godot
is the owner of the clipboard content and it's not necessary to query
the x server for it.
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.
Fixes: #28683, #28621, #28596 and maybe others
For iOS we enable pvrtc feature by default for all backends
Etc1 for iOS doesn't have any sense, so it disabled.
Fixed checks in export editor.
Fixed pvrtc encoding procedure.
Edit by Akien: Forward-ported from #38076, this may not make sense as is for
Godot 4.0, but it's important that we have the latest code in sync with 3.2
for when more rendering backends and proper iOS support are added back.
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
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).
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.
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.