gpui: Add Wayland support (#7664)

This PR adds Wayland support to gpui using
[wayland-rs](https://github.com/Smithay/wayland-rs). It is based on
[#7598](https://github.com/zed-industries/zed/pull/7598).

It detects Wayland support at runtime by checking the existence of the
`WAYLAND_DISPLAY` environment variable. If it does not exist or is
empty, the X11 backend will be used. To use the X11 backend in a Wayland
session (for development purposes), you just need to unset
WAYLAND_DISPLAY (`WAYLAND_DISPLAY= cargo run ...`).

At the moment it only creates the window and renders the initial content
provided by `BladeRenderer`, so it can run "Hello world" example.


![image](https://github.com/zed-industries/zed/assets/40907255/1655bc64-4d36-4178-9851-bfe42f03f716)

Todo:
- [x] Add basic Wayland support.
- [x] Add window resizing.
- [x] Add window closing.
- [x] Add window updating.
- [ ] Implement input handling, fractional scaling, and support other
Wayland protocols.
- [ ] Implement all unimplemented todo!(linux).
- [ ] Add window decorations or use custom decorations (like on MacOS).
- [ ] Address other missing functionality.

Release Notes:
- N/A

---------

Co-authored-by: gabydd <gabydinnerdavid@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Roman 2024-02-15 01:50:11 +03:00 committed by GitHub
parent 6e6ae0ef21
commit f62baeda64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 874 additions and 62 deletions

View file

@ -11,6 +11,7 @@ if [[ -n $apt ]]; then
libasound2-dev
libfontconfig-dev
vulkan-validationlayers*
libwayland-dev
)
$maysudo "$apt" install -y "${deps[@]}"
exit 0
@ -24,6 +25,7 @@ if [[ -n $dnf ]]; then
alsa-lib-devel
fontconfig-devel
vulkan-validation-layers
wayland-devel
)
$maysudo "$dnf" install -y "${deps[@]}"
exit 0
@ -37,6 +39,7 @@ if [[ -n $pacman ]]; then
alsa-lib
fontconfig
vulkan-validation-layers
wayland
)
$maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
exit 0