Commit Graph

296 Commits

Author SHA1 Message Date
Thaddeus Crews 3572bad292 Merge pull request #119141 from deralmas/wl/hover
Wayland: Improve hovered window handling
2026-05-26 10:09:39 -05:00
Naoto Kondo 814d08d77f Wayland: Fix incorrect fallback value for height in _xdg_popup_on_configure 2026-05-14 10:44:44 +09:00
Thaddeus Crews b786c890b6 Merge pull request #119252 from deralmas/wl/embedder-mods
Wayland Embedder: Track keyboard modifier keys
2026-05-06 14:56:32 -05:00
ArchercatNEO 3f29efc8a2 HDR: Implement surface supports HDR output.
Previously the Wayland display server would attempt to enable
HDR output and try to detect if it failed afterwards which had some issues.
Now we can query the rendering driver for support and avoid ever enabling
HDR output when this would fail.
2026-05-06 19:51:54 +01:00
Dery Almas ef5a2569e7 Wayland Embedder: Track keyboard modifier keys
The Wayland spec says:

> The compositor must send the wl_keyboard.modifiers event after this
event.

We did not during "fake" focus changes (e.g. from/to embedded
applications), effectively resetting the modifier state.

This patch simply tracks keyboard modifiers and informs clients whenever
we send custom enter events.
2026-05-05 12:49:26 +02:00
Dery Almas 5d961d10ec Wayland: Track transformed mouse position directly
`DisplayServer::get_mouse_position` expects global values, but input
usually works in surface-local coordinates.

Previously, we queried WaylandThread directly and transformed the mouse
position when requested, which was somewhat racy. We now instead keep
track of the transformed position while dispatching input events (as the
whole context is there) and return that when requested.
2026-05-01 13:11:09 +02:00
Dery Almas 1e26d5ef7b Wayland: Track mouse enter/exit events globally
Unlike Godot, Wayland doesn't have the concept of a single "mouse".
Because of this, we could easily emit "mouse enter/exit" events in weird
ways by e.g. using the tablet while using the mouse. This became even
easier to break with the addition of touch support.

This patch does its best to avoid this by tracking a single "hovered
window" and emitting events based on that. This logic is split between
`WaylandThread` and `DisplayServerWayland`:

 * `WaylandThread` does all the "smart" tracking and makes sure that, as
long as there's *any* device pointing something, the hovered window will
be set to something. For example: if I have a pointer on a window and
quickly tap anything, the hover will switch to whatever is under the
pointer instead of getting unset once my finger lifts from the screen.

 * `DisplayServerWayland` actually applies the hover change. This is
tricky as window event dispatching has side effects and might even
delete windows or change the hover itself!
2026-05-01 10:29:55 +02:00
Allen Pestaluky 4309120a4a Fix DisplayServerWayland::window_is_hdr_output_supported to check rendering device for HDR output support and adjust warnings/errors. 2026-04-20 11:11:01 -04:00
Pāvels Nadtočajevs 958510c3e9 Add a bunch of missing window existence checks to HDR methods 2026-04-17 15:53:13 +03:00
Thaddeus Crews 21dbe711c5 Merge pull request #113886 from deralmas/wl-touch
Wayland: Implement touch support
2026-04-15 14:02:35 -05:00
Thaddeus Crews 8e0030b4ee Merge pull request #118554 from deralmas/wl/complex-pointer-frames
Wayland: Handle complex pointer event frames
2026-04-14 07:11:03 -05:00
Dery Almas 3883ba2a34 Wayland: Handle complex pointer event frames
From the spec:

> The wl_pointer.enter and wl_pointer.leave events are logical events
> generated by the compositor and not the hardware. These events are
> also grouped by a wl_pointer.frame. When a pointer moves from one
> surface to another, a compositor should group the wl_pointer.leave
> event within the same wl_pointer.frame. However, a client must not
> rely on wl_pointer.leave and wl_pointer.enter being in the same
> wl_pointer.frame. Compositor-specific policies may require the
> wl_pointer.leave and wl_pointer.enter event being split across
> multiple wl_pointer.frame groups.

From my understanding™ this means that a compositor SHOULD group
leave/enter events together. Is this common? From my testing... Not
really. Notably, (only?) KDE does this.

Our pointer frame event assumed that we would be working with the
currently pointed window but since all events must be logically grouped
together I think it can really only group "normal" events related to the
*leave* event.

Now, whenever there's a pointer focus change, we send everything to the
old window, if it exists, otherwise the currently pointed one.

This approach seems to handle complex event frames with both leave and
enter events properly now, with good results on all compositors.

This patch also and makes it harder to get to a null check when the
window simply does not exists (the error was meant only for existing but
invalid windows), along with an helper method to aid in this.
2026-04-14 01:18:55 +02:00
Rémi Verschelde 7567211e8b GLES3: Split EGL includes in platform_egl.h
EGL brings in platform-specific headers such as the dreaded `windows.h`,
and `platform_gl.h` is used throughout `drivers/gles3` for basic OpenGL
types such as `GLuint`. We don't want `windows.h` pollution there.

Note for Android: EGL seems used explicitly only via `rasterizer_gles3.cpp`
to enable GL debug printing, and some custom stuff in `config.cpp`.
2026-04-07 12:07:22 +02:00
Dery Almas ac913816d4 Wayland: Initialize libdecor earlier
It has its own bookkeeping which would not immediately initialize in
certain setups, leading to crashes.
2026-04-04 23:09:22 +02:00
Thaddeus Crews e37b5c4035 Merge pull request #118076 from allenwp/output-max-linear-value-events
[Apple, Wayland] HDR Output: Emit window events when HDR state changes
2026-04-03 11:52:22 -05:00
ArchercatNEO 1d14370d55 Wayland: Fix building with libdecor=no 2026-04-03 10:08:11 +01:00
Allen Pestaluky f9145cbc72 Add HDR events for Wayland and Apple display servers
Co-authored-by: ArchercatNEO <tururu.pompella@gmail.com>
2026-04-02 12:50:38 -04:00
Thaddeus Crews 0f51ed6099 Merge pull request #113543 from bruvzg/win_icons
[DisplayServer] Add per window icon support.
2026-03-30 13:35:47 -05:00
Thaddeus Crews 5ee90d8e82 Merge pull request #117873 from deralmas/wl/send-reinforcements
Wayland: Unify clipboard sending code
2026-03-30 13:35:26 -05:00
Dery Almas b1c216d916 Wayland: Unify clipboard sending code
The primary and selection parts would constantly get out of sync.

Also fixes a wrong return value in `primary_get_mime`.
2026-03-27 04:33:52 +01:00
Rémi Verschelde e030230a99 Merge pull request #117445 from bruvzg/angle_no_dyn
[macOS/Windows] Remove dynamically linked ANGLE support, add flag to enable/disable ANGLE.
2026-03-26 16:01:25 +01:00
Rémi Verschelde c19a2705af Merge pull request #116692 from deralmas/wl/i-love-multithreading
Wayland: Fix race with buffer scaling
2026-03-26 16:01:14 +01:00
Rémi Verschelde 915f8dcba7 Merge pull request #116648 from gongpha/wayland-clipboard-fix
Fix clipboard history not updating on subsequent copies in Wayland
2026-03-26 16:01:08 +01:00
Pāvels Nadtočajevs 5fc9f6b3d9 [macOS/Windows] Remove dynamically linked ANGLE support, add flag to enable/disable ANGLE.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2026-03-23 13:01:25 +02:00
Pāvels Nadtočajevs d47b8d7a64 [DisplayServer] Add per window icon support. 2026-03-23 11:27:09 +02:00
ArchercatNEO 8be7b9f18c Wayland: Fix use-after-free of Ref<ColorManagementProfile>
Fixes #117676
PR #111964 made a Ref<ColorManagementProfile> which we intentionally
leaked across a client-server barrier owned, which caused a use-after-free.
Manually adding reference/unreference calls keeps the ptr valid without memory leaks.
2026-03-21 09:28:43 +00:00
Dery Almas ab135ca3c2 Wayland: Implement touch support 2026-03-20 15:42:20 +01:00
Dery Almas 2d74e56caf Wayland: Fix race with buffer scaling
We now pass the buffer scale along the window size to the display server
and set everything from there.

This should avoid races where the buffer scale changes while we handle
window rect changes.
2026-03-20 14:24:38 +01:00
Thaddeus Crews fb4a304dee Merge pull request #111965 from Ivorforce/memnew-typed
Make `memnew(RefCounted)` return `Ref`, to improve ownership safety
2026-03-19 15:39:15 -05:00
Thaddeus Crews fa4d24cbb5 Merge pull request #116513 from deralmas/wl/dedup-global-remove
Wayland: Deduplicate cleanup logic
2026-03-19 10:19:52 -05:00
Lukas Tenbrink 05c33acbb1 Make memnew(RefCounted) return Ref, to force callers to take ownership of it through a reference. 2026-03-18 20:34:08 +01:00
Thaddeus Crews 179ee951b6 Merge pull request #117530 from ArchercatNEO/wp-color-management-warning
Wayland: Only report HDR request failed warning if HDR was actually requested
2026-03-18 11:43:28 -05:00
Rémi Verschelde 98868393cc Style: Enforce #include validation hook 2026-03-18 10:41:59 +01:00
Rémi Verschelde e33e98a26f Style: Apply clang-format grouping rules 2026-03-17 20:11:01 +01:00
ArchercatNEO 5b66760492 Wayland: only emit HDR request failed warning if HDR was actually requested
Fixes #117527
2026-03-17 18:52:38 +00:00
Dery Almas 29e1bc5a23 Wayland: Deduplicate cleanup logic
We now reuse the `global_remove` event handler. This removes a
considerable amount of duplication, minimizes human error (such as
cleaning up a global in one place but not the other), and helps test the
dynamic global removal logic.
2026-03-16 23:51:08 +01:00
Thaddeus Crews 5d0a321575 Merge pull request #102987 from ArchercatNEO/wayland-hdr
[LinuxBSD] Add support for HDR output (Wayland)
2026-03-16 11:32:54 -05:00
Rémi Verschelde 0d7bd115da Remove unused includes in drivers with clangd-tidy 2026-03-14 22:38:02 +01:00
Rémi Verschelde d9b81615e5 Remove unused includes in platform with clangd-tidy
Handled Linux, Windows, Android, and (partially) Web.
2026-03-14 22:37:05 +01:00
ArchercatNEO eee3384e20 HDR output for linuxbsd (wayland) 2026-03-13 16:48:58 +00:00
Dery Almas eb680bc8c3 Wayland: Improve mapping robustness and synchronization
We assumed that a window will be ready after a single roundtrip but
that's actually not guaranteed by the XDG shell protocol.

This patch waits for an arbitrary timeout (10s) before erroring out and
forcefully closing the window. Since this exercised quite some code
paths, it also reworks some window handling logic and fixes a bunch of
synchronization issues.
2026-03-13 08:25:04 +01:00
Rémi Verschelde 727b06a79f Move ProcessID typedef out of OS
This allows decoupling a number of files from `os.h`.
2026-03-04 15:00:45 +01:00
Rémi Verschelde f332faf46b Explicitly include core/os/os.h where used 2026-03-04 09:54:10 +01:00
Rémi Verschelde 8c0f175c94 Decouple RenderingServer from as much of the codebase as possible
Notably decouples it from:
- AccessibilityServer
- DisplayServer
- Viewport
- Window
2026-03-03 12:48:07 +01:00
Rémi Verschelde a447ac95ec Move DisplayServer enums and typedefs to DisplayServerEnums
This will allow decoupling `display_server.h` from a number of headers in the
codebase which only require those enums and not all the DisplayServer API.
2026-03-03 12:44:02 +01:00
Pāvels Nadtočajevs 1306221592 Move accessibility methods/enums from DisplayServer to the AccessibilityServer dedicated singleton. 2026-03-02 13:48:29 +02:00
Rémi Verschelde f5a290ac46 Move RenderingServer enums to a dedicated RenderingServerEnums (RSE) namespace
A number of headers in the codebase included `rendering_server.h` just for
some enum definitions. This means that any change to `rendering_server.h` or
one of its dependencies would trigger a massive incremental rebuild.

With this change, we decouple a number of classes from `rendering_server.h`,
greatly speeding up incremental rebuilds for that area.

On my machine, this reduces incremental compilation time after an edit of
`rendering_server.h` by 60s (from 2m57s).
2026-02-25 19:43:03 +01:00
Kongfa Waroros 9c40e1d25b Fix clipboard history not updating on subsequent copies in Wayland 2026-02-23 04:45:49 +07:00
Lukas Tenbrink e9465cd380 Move variant pools to their own compile unit. 2026-02-21 13:24:17 +01:00
Rémi Verschelde ad4b910a10 Minimize include dependencies of display_server.h
- Removes `native_menu.h` dependency from `display_server.h`.
  It's now forward-declared in all DisplayServer implementations and should
  be included in the .cpp's.
- Removes some unused `rb_set.h` and `rb_map.h` dependencies, which leads to
  having to include them explicitly in half the scene and editor codebase...
  which shows how much we depend on `display_server.h`.
- Forward-declare `input_event.h`, so now we need only `keyboard.h`.
2026-02-17 19:45:31 +01:00