Skip to content

Commit

Permalink
Allow users to opt-out of default winit features (#3228)
Browse files Browse the repository at this point in the history
* Do not enable winit features by default

* Enable default winit features by default

* Add x11 feature
  • Loading branch information
emilk authored Aug 10, 2023
1 parent d568d9f commit 7e035c6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: cargo check --locked --no-default-features --lib --all-targets -p epaint

- name: check eframe --no-default-features
run: cargo check --locked --no-default-features --lib --all-targets -p eframe
run: cargo check --locked --no-default-features --features x11 --lib --all-targets -p eframe

- name: Test doc-tests
run: cargo test --doc --all-features
Expand Down
14 changes: 12 additions & 2 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]


[features]
default = ["accesskit", "default_fonts", "glow"]
default = [
"accesskit",
"default_fonts",
"glow",
"wayland",
"winit/default",
"x11",
]

## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
accesskit = ["egui/accesskit", "egui-winit/accesskit"]
Expand All @@ -42,6 +49,9 @@ glow = ["dep:glow", "dep:egui_glow", "dep:glutin", "dep:glutin-winit"]
## Enables wayland support and fixes clipboard issue.
wayland = ["egui-winit/wayland"]

## Enables compiling for x11.
x11 = ["egui-winit/x11"]

## Enable saving app state to disk.
persistence = [
"directories-next",
Expand Down Expand Up @@ -109,7 +119,7 @@ image = { version = "0.24", default-features = false, features = [
"png",
] } # Needed for app icon
raw-window-handle = { version = "0.5.0" }
winit = "0.28.1"
winit = { version = "0.28.1", default-features = false }

# optional native:
directories-next = { version = "2", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/egui-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ wgpu = "0.16.0"
## Enable this when generating docs.
document-features = { version = "0.2", optional = true }

winit = { version = "0.28", optional = true }
winit = { version = "0.28", default-features = false, optional = true }

# Native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
5 changes: 4 additions & 1 deletion crates/egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ all-features = true


[features]
default = ["clipboard", "links", "wayland", "winit/default"]
default = ["clipboard", "links", "wayland", "winit/default", "x11"]

## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
accesskit = ["accesskit_winit", "egui/accesskit"]
Expand All @@ -42,6 +42,9 @@ serde = ["egui/serde", "dep:serde"]
## Enables Wayland support.
wayland = ["winit/wayland"]

## Enables compiling for x11.
x11 = ["winit/x11"]

# Allow crates to choose an android-activity backend via Winit
# - It's important that most applications should not have to depend on android-activity directly, and can
# rely on Winit to pull in a suitable version (unlike most Rust crates, any version conflicts won't link)
Expand Down

0 comments on commit 7e035c6

Please sign in to comment.