Commit graph

64 commits

Author SHA1 Message Date
Pāvels Nadtočajevs
4310cb82b8
AccessKit integration for macOS, Linux, and Windows. 2025-04-08 20:25:47 +03:00
Riteo
84d3adcf2f Wayland: Implement native sub-windows
The backend is now mature enough to not explode with multiple windows
but the `DisplayServer` API still cannot meet some guarantees required
by the various Wayland protocols we use. To meet those guarantees this
patch adds three new elements to the DisplayServer API, with relative
handling logic for `Window` and `Popup` nodes:

 - `WINDOW_EVENT_FORCE_CLOSE`, which tells a window to *forcefully*
close itself and ensure a proper cleanup of its references, as Wayland
enforces this behavior;

 - `WINDOW_FLAG_POPUP_WM_HINT`, which explicitly declares a window as a
"popup", as Wayland enforces this distinction and heuristics are not
reliable enough;

 - `FEATURE_SELF_FITTING_WINDOWS`, which signals that the compositor can
fit windows to the screen automatically and that nodes should not do
that themselves.

Given the size of this feature, this patch also includes various
`WaylandThread` reworks and fixes including:

 - Improvements to frame wait logic, with fixes to various stalls and a
configurable (through a `#define`) timeout amount;

 - A proper implementation of `window_can_draw`;

 - Complete overhaul of pointer and tablet handling. Now everything is
always accumulated and handled only on each respective `frame` event.
This makes their logic simpler and more robust.

 - Better handling of pointer leaving and pointer enter/exit event
sending;

 - Keyboard focus tracking;

 - More solid window references using IDs instead of raw pointers as
windows can be deleted at any time;

 - More aggressive messaging to window nodes to enforce rects imposed by
the compositor.
2025-04-04 20:23:25 +02:00
Pāvels Nadtočajevs
52009b52d2
Detect KDE/LXQt and swap OK/Cancel buttons to Windows style. 2025-04-03 12:47:11 +03:00
Pāvels Nadtočajevs
4638ade13f
Enable TTS on demand, instead of fully disabling it when project setting is not set. 2025-04-01 15:24:46 +03:00
Thaddeus Crews
49fcd4ce46
Merge pull request #101546 from bruvzg/portal_color_picker
[Linux] Implement native color picker.
2025-03-17 10:52:29 -05:00
Pāvels Nadtočajevs
18f6c33d72
[DisplayServer] Implement get_accent_color on Linux. 2025-03-14 09:05:03 +02:00
bruvzg
3e4e6e6c0c Improve native file dialog parent window selection. 2025-03-06 17:15:39 +02:00
Riteo
cbd68eb403 Wayland: Fix engine stalls wihle waiting frames
There were two edge cases in the frame waiting logic (aka manual frame
throttling or emulated vsync) which would cause the editor to stall in
one way or another:

 1. Waiting right after starting the editor would cause a deadlock
between both threads until something happened in the Wayland event
queue, in turn unblocking the Wayland thread and kickstartin the whole
thing;

 2. Starting the editor (and probably other long-loading stuff) without
low consumption mode would suspend the window and never commit its
surfaces, thus never signaling the compositor that we want frame events.
2025-02-11 01:33:36 +01:00
Pāvels Nadtočajevs
05ca80632d [Linux] Implement native color picker. 2025-02-03 16:30:44 +02:00
Thaddeus Crews
480843cf2b
Merge pull request #101812 from bruvzg/portal_chk
[FreeDesktop portal] Check for `FileChooser` and `Settings` interface availability instead of assuming it's always available.
2025-02-03 08:16:10 -06:00
Thaddeus Crews
4f3dddbbff
Merge pull request #101987 from Riteo/imagine-using-rids
Wayland: Check custom cursor resource reference for cache invalidation
2025-01-31 09:15:52 -06:00
Pāvels Nadtočajevs
86f56efbaa [FreeDesktop portal] Check for FileChooser and Settings interface availability instead of assuming it's always available. 2025-01-31 07:52:40 +02:00
Adam Scott
47f553ae0b
Delegate to the DisplayServer the task of handling mouse_mode
- Add `MOUSE_MODE_MAX` and various index checks
2025-01-28 11:22:27 -05:00
Riteo
c8087567c9 Wayland: Check custom cursor resource reference for cache invalidation
Images don't have RIDs and this way of checking stuff broke the cursor
cache. Let's do like all other platforms and check the resource
reference instead.
2025-01-24 15:10:46 +01:00
Riteo Siuga
368a59e6f9 Wayland: Release pressed events on application focus out
Looks like I always assumed wrongly that the compositor would send us
key release events when unfocusing... It did not.
2025-01-20 01:38:25 +01:00
Pāvels Nadtočajevs
133ea4f17a [Wayland] Fix excessive IME updates. 2025-01-17 15:29:06 +02:00
Pāvels Nadtočajevs
2e99d84e87 [DisplayServer] Add missing FEATURE_WINDOW_DRAG flag to Windows, X11 and Wayland display servers. 2025-01-14 15:26:32 +02:00
Riteo
e5ac45e822 Wayland: Unsuspend only for the same reason as suspension
Before, we would check both methods together, leading to loops.

Now we track the actual reason we suspended and only unsuspend when
that same reason triggers. For example, if we suspend because of the
suspended flag we'll unsuspend only because it got unset. Conversely, if
we suspend because of a timeout we'll unsuspend only if we get a new
frame event.

We do this because, while some compositors properly report a "suspended"
state (hinting us to stop repainting), most don't and we need a "safety
net" anyways as we do not want to constantly stay at 1fps (the max time
we'll wait before giving up) either.
2025-01-08 13:53:01 +01:00
Pāvels Nadtočajevs
7f0b4e58b0 Implement DisplayServer.window_start_resize. 2025-01-07 07:58:02 +02:00
Pāvels Nadtočajevs
e1f129cb52 Support MIME types in file dialog filters on macOS and Linux. 2025-01-04 22:05:35 +02:00
Hilderin
9d2a4c03be Embedding game process in editor 2024-12-18 17:52:42 -05:00
Pāvels Nadtočajevs
293be04ec8 Implement window_start_drag on Windows and Linux. 2024-12-17 16:49:27 +02:00
Pāvels Nadtočajevs
84650f2018 Implement DisplayServer.beep. 2024-12-03 12:43:26 +02:00
Anish Mishra
0dfd18c84b [DisplayServer] Add feature flag for native file dialog access to user/res and options 2024-10-30 14:13:43 +05:30
Summersay415
6d14cd6ff9 Fix fallbacks to OpenGL 2024-10-28 22:57:19 +07:00
Thaddeus Crews
07e759b74a
Merge pull request #97771 from dsnopek/openxr-linux-egl
OpenXR: Add support for Wayland on Linux
2024-10-25 13:04:08 -05:00
Matias N. Goldberg
0818408db5 Fix wrong Wayland path if building with opengl3=no
Godot checks if there's Vulkan or GLES3 support.
If no support is found, it shows an error message.

However the code for this error message is left out when building with
opengl3=no
2024-10-12 20:20:12 -03:00
David Snopek
256699ee31 OpenXR: Add support for Wayland on Linux 2024-10-04 11:44:05 -05:00
Joaquim Monteiro
c4e4810e93
Fallback to OpenGL 3 if Vulkan isn't available on Wayland 2024-09-21 06:35:35 +01:00
Riteo
c15cd3acc4 Wayland: Simplify cursor code and fix custom cursors
Initially the WaylandThread cursor code was supposed to be as stateless
as possible but, as time went on, this wasn't possible.

This expectation made the resulting API quite convoluted, so this patch
aims to simplify it substantially bot in terms of API surface and, most
importantly, in terms of actual implementation complexity.

This patch also fixes custom cursors since I accidentally changed the
mmap flags to MAP_PRIVATE some time ago. This took me hours to notice.
2024-09-13 19:08:53 +02:00
Rémi Verschelde
9abf86f4fe
Merge pull request #96540 from hunterkepley/fix-wayland-middlemouse-paste
Wayland: Fix primary clipboard handling
2024-09-04 11:16:42 +02:00
Rémi Verschelde
8eff04192b
Merge pull request #91780 from Riteo/falling-with-style
Improve UX when falling back between Display Servers
2024-09-04 11:16:08 +02:00
hunterkepley
7949585aad Wayland: Fix primary clipboard handling 2024-09-03 22:39:54 -04:00
bruvzg
c273786758
Update rendering driver name on fallbacks. Fix rendering driver/method in the editor system info. 2024-09-01 18:22:40 +03:00
Riteo
33e414cf75 Wayland: report when video drivers can't be loaded or found
This brings it to parity with the X11 backend.
2024-08-21 07:15:08 +02:00
Riteo
84f26a629d Wayland: check for suspended flag when unsuspending
Before, we would only check for the frame flag, which is unreliable on
newer suspension-aware compositors.
2024-07-16 00:11:22 +02:00
Pedro J. Estébanez
32d9c93af3 Improve handling of rendering startup errors 2024-06-28 19:31:50 +02:00
Riteo
f27471fbd8 Wayland: minimize surface commits and limit them to the main thread
Before of this patch, as explained in the usual
commented-wall-of-text-longer-than-the-actual-patch-itself™, due to the
multithreaded nature of the Wayland thread, it was possible to commit a
surface while the renderer was doing stuff, which was _very_ wrong.

Initially the consequences of such a sin weren't obvious but, now that
explicit synchronization is becoming more and more common, we can't
commit a buffer randomly without basically guaranteeing a nasty, nasty
crash (and we should have avoided commits altogether in the first place
to ensure atomic surface updates).

We now only trigger a commit _in the main thread_ when low processor usage
mode is on _and_ if we know that we won't be rendering anything as, due to
its intermittent nature, it makes "legacy" (pre xdg_wm_base v6) frame
callback based suspension quite annoying.
2024-06-28 01:47:25 +02:00
Rémi Verschelde
4e01d8663e
Merge pull request #93021 from bruvzg/wl_ime
[Wayland] Implement IME support.
2024-06-19 10:10:09 +02:00
Rémi Verschelde
e15c2e051e
Merge pull request #92663 from Riteo/holy-egl-batman
EGL: Use `EGL_EXT_platform_base` whenever possible
2024-06-13 17:19:17 +02:00
bruvzg
be25e60f61
[Wayland] Implement IME support. 2024-06-11 12:24:54 +03:00
kleonc
91e995e704 Fix creating cursor image from AtlasTexture 2024-06-05 01:44:05 +02:00
Riteo
8f69f29694 EGL: Use EGL_EXT_platform_base whenever possible
This avoids any assumption from the driver, which would otherwise select
a specific platform and potentially mess up everything, resulting
usually in a display server failure.
2024-06-04 08:43:34 +02:00
Rémi Verschelde
c98fef08bf
Merge pull request #89033 from bruvzg/doc_end_err
[DisplayServer] Add error messages and descriptions to callbacks.
2024-05-28 17:48:42 +02:00
bruvzg
714effdf07
[DisplayServer] Add error messages and descriptions to callbacks. 2024-05-28 17:36:54 +03:00
Riteo
9734feb449 Wayland: Implement is_window_transparency_available 2024-05-26 00:05:47 +02:00
Paulo Poiati
a3769c0edc Properly set window class in Wayland 2024-05-22 10:42:12 -03:00
Riteo
1bb8199342 Wayland: Workaround API limitation in screen/UI scale logic
Mainly, this fixes auto UI scaling with _single-monitor_ fractional
setups (see the comment in `display_server_wayland.cpp` for more info).

This is the result of a bunch of current limitations, mainly the fact
that the UI scale is static (it's probed at startup) and the fact that
Wayland exposes fractional scales only at the window-level, by design.

The `screen_get_scale` special case should help in 99% of cases, while
the auto UI scale part will unfortunately only help with single-screen
situations, as multi-screen fractional scaling requires dynamic UI
scale changing.
2024-05-07 19:50:48 +02:00
Riteo
d3279fa552 Wayland: Add support for OpenGL ES driver
Everything was already there, we just had to wire it up in the display
server.
2024-05-03 05:17:13 +02:00
bruvzg
67d6be30a0
[DBus] Process file dialog callback in the main event loop instead of using deferred call. 2024-04-23 19:32:35 +03:00