Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland backend #535

Merged
merged 16 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ pub enum WebGLVersion {
WebGL2,
}

/// On Wayland, specify how to draw client-side decoration (CSD) if server-side decoration (SSD) is
/// not supported (e.g., on GNOME).
///
/// Defaults to ServerWithLibDecorFallback
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum WaylandDecorations {
/// If SSD is not supported, will try to load `libdecor` to draw CSD. This is the default
/// choice.
#[default]
ServerWithLibDecorFallback,
/// If SSD is not supported, draw a light gray border.
ServerWithMiniquadFallback,
/// If SSD is not supported, no CSD will be drawn.
ServerOnly,
}

/// Platform-specific settings.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Platform {
Expand Down Expand Up @@ -143,14 +159,16 @@ pub struct Platform {
/// - TODO: Document(and check) what does it actually mean on android. Transparent window?
pub framebuffer_alpha: bool,

/// When using Wayland, this controls whether to draw the default window decorations.
pub wayland_use_fallback_decorations: bool,
/// On Wayland, specifies how to draw client-side decoration (CSD) if server-side decoration (SSD) is
/// not supported (e.g., on GNOME).
pub wayland_decorations: WaylandDecorations,

/// Set the `WM_CLASS` window property on X11
/// Set the `WM_CLASS` window property on X11 and the `app_id` on Wayland. This is used
/// by gnome to determine the window icon (together with an external `.desktop` file).
// in fact `WM_CLASS` contains two strings "instance name" and "class name"
// for most purposes they are the same so we just use class name for simplicity
// https://unix.stackexchange.com/questions/494169/
pub linux_x11_wm_class: &'static str,
pub linux_wm_class: &'static str,
}

impl Default for Platform {
Expand All @@ -163,8 +181,8 @@ impl Default for Platform {
blocking_event_loop: false,
swap_interval: None,
framebuffer_alpha: false,
wayland_use_fallback_decorations: true,
linux_x11_wm_class: "miniquad-application",
wayland_decorations: WaylandDecorations::default(),
linux_wm_class: "miniquad-application",
}
}
}
Expand Down Expand Up @@ -203,8 +221,8 @@ pub struct Conf {
/// - On macOS, Dock/title bar icon
/// - TODO: Favicon on HTML5
/// - TODO: Taskbar/title bar icon on Linux (depends on WM)
/// - Note: on gnome (with X11), icon is determined using `WM_CLASS` (can be set under
/// `Platform`) and an external `.desktop` file
/// - Note: on gnome, icon is determined using `WM_CLASS` (can be set under [`Platform`]) and
/// an external `.desktop` file
pub icon: Option<Icon>,

/// Platform-specific hints (e.g., context creation, driver settings).
Expand Down
Loading
Loading