Commit graph

50 commits

Author SHA1 Message Date
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
Rémi Verschelde
f98c259131
Merge pull request #92353 from Riteo/you-cant-see-me
Wayland: Implement `is_window_transparency_available`
2024-05-28 15:49:33 +02:00
Riteo
9734feb449 Wayland: Implement is_window_transparency_available 2024-05-26 00:05:47 +02:00
Joel Winarske
f06dd46eb7 Enable build config wayland=yes use_sowrap=no
-wayland-egl.h was missing if opengl3=yes (default)

Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
2024-05-25 07:15:57 -07:00
Paulo Poiati
a3769c0edc Properly set window class in Wayland 2024-05-22 10:42:12 -03:00
Rémi Verschelde
039aa28a60
Merge pull request #89574 from Riteo/scale-your-expectations-with-this-one
Wayland: Workaround API limitation in screen/UI scale logic
2024-05-07 21:52:44 +02: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
A Thousand Ships
955d5affa8
Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +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
A Thousand Ships
308dbb8c63
[Core] Add scalar versions of Vector* min/max/clamp/snap(ped)
Convenience for a number of cases operating on single values
2024-05-02 10:31:13 +02:00
Riteo
2b34ba6d4b Wayland: Improve compositor compatibility by allowing older globals
Previously we pretty much hardcoded most of the globals we requested,
causing compatibility issues with certain compositors like Weston, which
support only some pretty old versions or miss some more advanced
protocols.

To put fuel on the fire, we also errored out when certain protocols
weren't available, despite us being able to boot a game just fine (but
obviously with a degraded featureset).

The solution is to simply allow all the way from version 1 to the
current latest, adding some compatibility code (such as for older
`wl_output`s or newer `wl_pointer`s).

While we're at it, this commit also fixes a few typos and naming inconsistencies
I found.
2024-04-26 15:52:10 +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
Pedro J. Estébanez
c28f5901c7 Polish interaction between windowing, input and rendering
- Adapt GL make/release API to the current architecture.
- Fix DisplayServer being locked while dispatching input (prevent deadlocks).
2024-04-10 18:47:42 +02:00
bruvzg
dc01658ee9
[DisplayServer] Add separate feature flags for different native dialog types. 2024-03-26 15:18:06 +02:00
Rémi Verschelde
9335b83a32
Merge pull request #87831 from Riteo/bitfield-xor
Core: Implement a XOR operator for BitField
2024-03-26 13:45:02 +01:00
A Thousand Ships
9aa99c0a9d
[Wayland] Fix typo in input code 2024-03-20 10:37:08 +01:00
Thaddeus Crews
3b3e2374c9
clang-tidy: Enforce modernize-use-nullptr 2024-03-12 10:59:53 -05:00
Rémi Verschelde
2cb884bdbd
Merge pull request #89328 from Riteo/wayland-cursor-frame-opt
Wayland: Setup next cursor frame callback only if animated
2024-03-09 22:20:12 +01:00
Rémi Verschelde
3ca230df25
Merge pull request #89307 from alesliehughes/wayland_usage
Wayland: Stop possible Null pointer dereferences
2024-03-09 22:19:48 +01:00
Riteo
120936f78c Wayland: Setup next cursor frame callback only if animated
Before, the cursor kept updating for no good reason really.

It's also a bit neater and it ever-so-slightly makes `WAYLAND_DEBUG`
logs easier to read, although they're still spammed by the window's
frame logic (which is needed).
2024-03-09 20:32:54 +01:00
Alistair Leslie-Hughes
82a052a008 wayland: Stop possible Null pointer dereferences 2024-03-09 21:50:55 +11:00
Alistair Leslie-Hughes
d3ebae5e33 wayland: Stop unreachable warning 2024-03-09 21:50:39 +11:00
Rémi Verschelde
13954fc33e
Merge pull request #87452 from bruvzg/native_menu
Move `global_menu_*` methods to a separate `NativeMenu` class.
2024-03-06 13:16:52 +01:00
Rémi Verschelde
f9ebd84b5a
Merge pull request #89178 from Riteo/gotta-have-them-all
Wayland: Properly report all used features
2024-03-05 14:55:36 +01:00
bruvzg
c65a667924
Move global_menu_* methods to a separate NativeMenu class. 2024-03-04 23:41:41 +02:00
Riteo
ea4be5d3df Wayland: Properly report all used features
Oops, missed a few.
2024-03-04 21:08:37 +01:00
A Thousand Ships
9273106bb3
[Wayland] Fix tilt handling 2024-03-03 20:45:07 +01:00
Rémi Verschelde
6d9a529c87
Merge pull request #88970 from KoBeWi/ImageCursor2D
Improve `cursor_set_custom_image()` method
2024-02-29 13:54:53 +01:00
kobewi
3aeb4a5542 Improve cursor_set_custom_image() method 2024-02-28 20:32:25 +01:00
Riteo
b01a36b3cd Wayland: Restore tablet support and handle multiple tools
This code was already partially there, although heavily incomplete and
nowadays commented out.

It got broken after the `WaylandThread` refactor and I didn't bother to
bring it over, preferring to `#if 0` it into oblivion for the time
being as I don't have a tablet/pen which support an eraser and tilt
reporting.

This commit brings it back and adds proper multi-tool support (needed
for eraser detection) thanks to winston-yallow, who could test this code
with their more capable tablet.
2024-02-28 13:08:31 +01:00
Riteo
2e07dcf1e7 Wayland: suspend window after frame timeout or suspend state
This is a pretty popular approach that took a while for me to wrap my
head around and which only recently got "official" support through an
update (xdg_shell version 6), so I think that this is all-in-all a
better option than the overkill 2000Hz ticking we have now :P

Basically, we wait for a frame event and, if either too much time passes
or we get the new `suspended` state, we consider the window as "hidden"
and stop drawing, ticking by the low usage rate.

This should work great for KDE and Mutter, which support the new state,
but not yet for sway, which is still stuck at a very old xdg_shell
version and thus falls back to the timeout approach.

Be aware that if we rely on timing out the engine will have to stall for
the whole timeout, which _could_ be problematic but doensn't seem like
it. Further testing is needed.

Special thanks go to the guys over at #wayland on OFTC, who very
patiently explained me this approach way too many times.
2024-02-15 23:48:56 +01:00
bruvzg
ee53ae28df
Add method to get "base" system UI color (macOS/Windows) and system theme change callback. 2024-02-13 18:38:53 +02:00
Dario
73eff10c76 Finish splitting functionality of the Vulkan and D3D12 backends into RenderingDeviceDriver. 2024-02-12 10:02:18 -03:00
Rémi Verschelde
4e990cd7e5
Merge pull request #88134 from akien-mga/scons-wayland-py3.12-escape
SCons: Use r-strings for wayland-scanner builder command
2024-02-09 18:10:19 +01:00
Rémi Verschelde
74b03edf1e
Merge pull request #82800 from Sauermann/fix-screen-mousemotion
Add screen-related attributes to mouse input events
2024-02-09 18:08:58 +01:00
Rémi Verschelde
03c8a0d089
SCons: Use r-strings for wayland-scanner builder command
Silences a Python 3.12 warning.
2024-02-09 15:52:20 +01:00
Rémi Verschelde
7223c5b54a
Fix various typos with codespell
Using 2.2.7.dev115+g0eb441d6.

Had to add `cancelled` to the ignore list, as it's a Wayland signal which
we're handling in our code, so we don't want codespell to fix that "typo".

Also includes the typo fix from #87927.

Co-authored-by: Divyanshu Shekhar <61140213+divshekhar@users.noreply.github.com>
2024-02-07 11:09:34 +01:00
Jakub Marcowski
292df42c3f wayland: Update to 1.22.0 2024-02-06 10:23:42 +01:00
Markus Sauermann
2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
Riteo
7739940202 Core: Implement a XOR operator for BitField 2024-02-01 20:44:40 +01:00
Rémi Verschelde
9adb7c7d13
Merge pull request #87764 from Riteo/wayland-native-handle
Wayland: Implement `window_get_native_handle`
2024-01-31 14:01:59 +01:00
bruvzg
edb21e0573
[Wayland] Add support for native file dialogs. 2024-01-31 14:13:19 +02:00
Riteo
d8658df94e Wayland: implement window_get_native_handle
This will be the most useful for stuff like OpenXR, although we'd need a
way to eventually also expose the EGL handles.
2024-01-31 11:57:05 +01:00
Riteo
7e0f7d3abd Add Wayland support
Not everything is yet implemented, either for Godot or personal
limitations (I don't have all hardware in the world). A brief list of
the most important issues follows:

- Single-window only: the `DisplayServer` API doesn't expose enough
information for properly creating XDG shell windows.

- Very dumb rendering loop: this is very complicated, just know that
the low consumption mode is forced to 2000 Hz and some clever hacks are
in place to overcome a specific Wayland limitation. This will be
improved to the extent possible both downstream and upstream.

- Features to implement yet: IME, touch input, native file dialog,
drawing tablet (commented out due to a refactor), screen recording.

- Mouse passthrough can't be implement through a poly API, we need a
rect-based one.

- The cursor doesn't yet support fractional scaling.

- Auto scale is rounded up when using fractional scaling as we don't
have a per-window scale query API (basically we need
`DisplayServer::window_get_scale`).

- Building with `x11=no wayland=yes opengl=yes openxr=yes` fails.

This also adds a new project property and editor setting for selecting the
default DisplayServer to start, to allow this backend to start first in
exported projects (X11 is still the default for now). The editor setting
always overrides the project setting.

Special thanks to Drew Devault, toger5, Sebastian Krzyszkowiak, Leandro
Benedet Garcia, Subhransu, Yury Zhuravlev and Mara Huldra.
2024-01-30 16:44:47 +01:00