73 Commits

Author SHA1 Message Date
Rémi Verschelde
c596d93478
Merge pull request #106175 from akien-mga/linux-build-no-dbus
Linux: Fix build with `dbus=no` or `threads=no`
2025-06-09 00:44:12 +02:00
Pāvels Nadtočajevs
2d93e004b9
Cleanup and unify DisplayServer screen methods and documentation. 2025-06-02 08:03:48 +03:00
Rémi Verschelde
8b93b67e14
Merge pull request #106315 from Riteo/popping-up-everywhere
Wayland: Fix error spam when closing popup
2025-05-13 01:05:49 +02:00
Riteo
c3b04e6e1e Wayland: fix error spam when closing popup
Previously we did not check whether the value actually changed or not
and thus would get constant errors for no reason.
2025-05-12 05:11:24 +02:00
Pāvels Nadtočajevs
5441a82cfb
Do not call accessibility_set_window_rect on Wayland, fix main windows accessibility context creation. 2025-05-11 12:51:46 +03:00
Rémi Verschelde
e9e8ddc5be
Linux: Fix build with dbus=no or threads=no 2025-05-09 15:26:13 +02:00
Riteo Siuga
d4dabd15aa Wayland: Ensure pointed window's existence in mouse_get_position
Should fix a crash with certain compositors.
2025-05-03 20:24:44 +02:00
tthhr
e7a3729175 fix:Compile error in wayland display server when compiling linuxbsd platform after disabling dbus 2025-04-30 14:22:52 +08:00
Riteo Siuga
48882f3ca4 Wayland: Handle fifo_v1 and clean up suspension logic
Before, the WSI was unfortunately quite broken and we had work around it
by manually pacing frames. Needless to say it was not an ideal solution.

Now, the WSI can make use of the new fifo_v1 protocol to work properly.
If it's available, we'll trust the WSI by disabling manual frame pacing.

While we're at it, let's clean up the suspension code a bit by removing
some duplicated stuff and handling the suspension state through a switch
case.
2025-04-20 18:05:35 +02:00
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