Browse Source

egui_winit: support winit with default features disabled (#1971)

* egui_winit: support winit with default features disabled

* Link to the PR in the changelog
pull/1990/head
Koute 2 years ago
committed by GitHub
parent
commit
be9f363c53
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      crates/egui-winit/CHANGELOG.md
  2. 6
      crates/egui-winit/Cargo.toml
  3. 3
      crates/egui-winit/src/lib.rs
  4. 3
      sh/check.sh

3
crates/egui-winit/CHANGELOG.md

@ -3,7 +3,8 @@ All notable changes to the `egui-winit` integration will be noted in this file.
## Unreleased ## Unreleased
* The default features of the `winit` crate are not enabled if the default features of `egui-winit` are disabled too ([#1971](https://github.com/emilk/egui/pull/1971))
* Added new feature `wayland` which enables Wayland support ([#1971](https://github.com/emilk/egui/pull/1971))
## 0.19.0 - 2022-08-20 ## 0.19.0 - 2022-08-20
* MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)). * MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)).

6
crates/egui-winit/Cargo.toml

@ -18,7 +18,7 @@ all-features = true
[features] [features]
default = ["clipboard", "links"] default = ["clipboard", "links", "wayland", "winit/default"]
## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast [`egui::epaint::Vertex`], [`egui::Vec2`] etc to `&[u8]`. ## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast [`egui::epaint::Vertex`], [`egui::Vec2`] etc to `&[u8]`.
bytemuck = ["egui/bytemuck"] bytemuck = ["egui/bytemuck"]
@ -39,6 +39,8 @@ screen_reader = ["tts"]
## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde). ## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
serde = ["egui/serde", "dep:serde"] serde = ["egui/serde", "dep:serde"]
## Enables Wayland support.
wayland = ["winit/wayland"]
[dependencies] [dependencies]
egui = { version = "0.19.0", path = "../egui", default-features = false, features = [ egui = { version = "0.19.0", path = "../egui", default-features = false, features = [
@ -46,7 +48,7 @@ egui = { version = "0.19.0", path = "../egui", default-features = false, feature
] } ] }
instant = { version = "0.1", features = ["wasm-bindgen"] } # We use instant so we can (maybe) compile for web instant = { version = "0.1", features = ["wasm-bindgen"] } # We use instant so we can (maybe) compile for web
tracing = { version = "0.1", default-features = false, features = ["std"] } tracing = { version = "0.1", default-features = false, features = ["std"] }
winit = "0.27.2" winit = { version = "0.27.2", default-features = false }
#! ### Optional dependencies #! ### Optional dependencies

3
crates/egui-winit/src/lib.rs

@ -21,6 +21,8 @@ mod window_settings;
pub use window_settings::WindowSettings; pub use window_settings::WindowSettings;
use winit::event_loop::EventLoopWindowTarget; use winit::event_loop::EventLoopWindowTarget;
#[cfg(feature = "wayland")]
#[cfg(any( #[cfg(any(
target_os = "linux", target_os = "linux",
target_os = "dragonfly", target_os = "dragonfly",
@ -777,6 +779,7 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option<winit::window::Curs
/// Returns a Wayland display handle if the target is running Wayland /// Returns a Wayland display handle if the target is running Wayland
fn wayland_display<T>(_event_loop: &EventLoopWindowTarget<T>) -> Option<*mut c_void> { fn wayland_display<T>(_event_loop: &EventLoopWindowTarget<T>) -> Option<*mut c_void> {
#[cfg(feature = "wayland")]
#[cfg(any( #[cfg(any(
target_os = "linux", target_os = "linux",
target_os = "dragonfly", target_os = "dragonfly",

3
sh/check.sh

@ -37,7 +37,8 @@ cargo doc --document-private-items --no-deps --all-features
(cd crates/egui_extras && cargo check --no-default-features) (cd crates/egui_extras && cargo check --no-default-features)
(cd crates/egui_glium && cargo check --no-default-features) (cd crates/egui_glium && cargo check --no-default-features)
(cd crates/egui_glow && cargo check --no-default-features) (cd crates/egui_glow && cargo check --no-default-features)
(cd crates/egui-winit && cargo check --no-default-features) (cd crates/egui-winit && cargo check --no-default-features --features "wayland")
(cd crates/egui-winit && cargo check --no-default-features --features "winit/x11")
(cd crates/emath && cargo check --no-default-features) (cd crates/emath && cargo check --no-default-features)
(cd crates/epaint && cargo check --no-default-features --release) (cd crates/epaint && cargo check --no-default-features --release)
(cd crates/epaint && cargo check --no-default-features) (cd crates/epaint && cargo check --no-default-features)

Loading…
Cancel
Save