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

Add x11 and wayland features to egui-wgpu and egui_glow #3909

Merged
merged 4 commits into from
Jan 30, 2024
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
12 changes: 10 additions & 2 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ puffin = [
]

## Enables wayland support and fixes clipboard issue.
wayland = ["egui-winit/wayland"]
wayland = [
"egui-winit/wayland",
"egui-wgpu?/wayland",
"egui_glow?/wayland",
]

## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web.
##
Expand All @@ -114,7 +118,11 @@ web_screen_reader = [
wgpu = ["dep:wgpu", "dep:egui-wgpu", "dep:pollster"]

## Enables compiling for x11.
x11 = ["egui-winit/x11"]
x11 = [
"egui-winit/x11",
"egui-wgpu?/x11",
"egui_glow?/x11",
]

## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit.
## This is used to generate images for examples.
Expand Down
8 changes: 7 additions & 1 deletion crates/egui-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ all-features = true
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin"]

## Enable [`winit`](https://docs.rs/winit) integration.
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
winit = ["dep:winit"]

## Enables Wayland support for winit.
wayland = ["winit?/wayland"]

## Enables x11 support for winit.
x11 = ["winit?/x11"]

Comment on lines +34 to +42
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user is using egui-wgpu with the winit feature, they are also depending directly on winit, and can set the x11/wayland features themselves, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but then you have to think about that when running cargo check, cargo doc etc, which is the problem noted in the issues. Technically you don't have to enable these features in a real project, they just help make the repo more ergonomic to work with. I don't know if there is a better solution.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem would still happen with cargo check though, just not with cargo check --all-features ?


[dependencies]
egui = { version = "0.25.0", path = "../egui", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ syntect = ["egui_demo_lib/syntect"]

glow = ["eframe/glow"]
wgpu = ["eframe/wgpu", "bytemuck", "dep:wgpu"]
wayland = ["eframe/wayland"]
x11 = ["eframe/x11"]

[dependencies]
chrono = { version = "0.4", default-features = false, features = [
Expand Down
8 changes: 7 additions & 1 deletion crates/egui_glow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ links = ["egui-winit?/links"]
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin", "egui-winit?/puffin", "egui/puffin"]

## Enable [`winit`](https://docs.rs/winit) integration.
## Enable [`winit`](https://docs.rs/winit) integration. On Linux, requires either `wayland` or `x11`
winit = ["egui-winit", "dep:winit"]

## Enables Wayland support for winit.
wayland = ["winit?/wayland"]

## Enables x11 support for winit.
x11 = ["winit?/x11"]


[dependencies]
egui = { version = "0.25.0", path = "../egui", default-features = false, features = [
Expand Down
17 changes: 15 additions & 2 deletions scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,23 @@ cargo test --quiet --all-targets --all-features
cargo test --quiet --doc # slow - checks all doc-tests

cargo check --quiet -p eframe --no-default-features --features "glow"
cargo check --quiet -p eframe --no-default-features --features "wgpu"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cargo check --quiet -p eframe --no-default-features --features "wgpu","x11"
cargo check --quiet -p eframe --no-default-features --features "wgpu","wayland"
else
cargo check --quiet -p eframe --no-default-features --features "wgpu"
fi

cargo check --quiet -p egui --no-default-features --features "serde"
cargo check --quiet -p egui_demo_app --no-default-features --features "glow"
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","x11"
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","wayland"
else
cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu"
fi

cargo check --quiet -p egui_demo_lib --no-default-features
cargo check --quiet -p egui_extras --no-default-features
cargo check --quiet -p egui_glow --no-default-features
Expand Down
Loading