Skip to content

Commit

Permalink
Merge branch 'emilk:master' into patch90
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Aug 31, 2024
2 parents 911000d + da04339 commit 821456e
Show file tree
Hide file tree
Showing 143 changed files with 2,035 additions and 1,103 deletions.
7 changes: 0 additions & 7 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
# clipboard api is still unstable, so web-sys requires the below flag to be passed for copy (ctrl + c) to work
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93
[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis"]

[alias]
xtask = "run --quiet --package xtask --"
6 changes: 1 addition & 5 deletions .github/workflows/deploy_web_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ concurrency:
cancel-in-progress: false

env:
# web_sys_unstable_apis is required to enable the web_sys clipboard API which eframe web uses,
# as well as by the wasm32-backend of the wgpu crate.
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
Expand Down
34 changes: 27 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
on: [push, pull_request]
on: [ push, pull_request ]

name: Rust

env:
# web_sys_unstable_apis is required to enable the web_sys clipboard API which eframe web uses,
# as well as by the wasm32-backend of the wgpu crate.
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
Expand Down Expand Up @@ -61,6 +57,10 @@ jobs:
- name: check epaint --no-default-features
run: cargo check --locked --no-default-features --lib -p epaint

# Regression test for https://github.com/emilk/egui/issues/4771
- name: cargo check -p test_egui_extras_compilation
run: cargo check -p test_egui_extras_compilation

- name: Test doc-tests
run: cargo test --doc --all-features

Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: wasm-bindgen
uses: jetli/[email protected]
with:
version: "0.2.92"
version: "0.2.93"

- run: ./scripts/wasm_bindgen_check.sh --skip-setup

Expand Down Expand Up @@ -167,6 +167,26 @@ jobs:

# ---------------------------------------------------------------------------

ios:
name: ios
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
targets: aarch64-apple-ios

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

# Default features are disabled because glutin doesn't compile for ios.
- run: cargo check --features wgpu --target aarch64-apple-ios --no-default-features
working-directory: crates/eframe

# ---------------------------------------------------------------------------

windows:
name: Check Windows
runs-on: windows-latest
Expand Down
81 changes: 45 additions & 36 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ dependencies = [

[[package]]
name = "calloop"
version = "0.12.4"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
dependencies = [
"bitflags 2.6.0",
"log",
Expand All @@ -646,9 +646,9 @@ dependencies = [

[[package]]
name = "calloop-wayland-source"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02"
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
dependencies = [
"calloop",
"rustix 0.38.21",
Expand Down Expand Up @@ -2235,9 +2235,9 @@ dependencies = [

[[package]]
name = "js-sys"
version = "0.3.69"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
dependencies = [
"wasm-bindgen",
]
Expand Down Expand Up @@ -3490,9 +3490,9 @@ dependencies = [

[[package]]
name = "sctk-adwaita"
version = "0.9.1"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7555fcb4f753d095d734fdefebb0ad8c98478a21db500492d87c55913d3b0086"
checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec"
dependencies = [
"ab_glyph",
"log",
Expand Down Expand Up @@ -3627,9 +3627,9 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"

[[package]]
name = "smithay-client-toolkit"
version = "0.18.1"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
dependencies = [
"bitflags 2.6.0",
"calloop",
Expand All @@ -3652,9 +3652,9 @@ dependencies = [

[[package]]
name = "smithay-clipboard"
version = "0.7.0"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb62b280ce5a5cba847669933a0948d00904cf83845c944eae96a4738cea1a6"
checksum = "cc8216eec463674a0e90f29e0ae41a4db573ec5b56b1c6c1c71615d249b6d846"
dependencies = [
"libc",
"smithay-client-toolkit",
Expand Down Expand Up @@ -3804,6 +3804,14 @@ dependencies = [
"winapi-util",
]

[[package]]
name = "test_egui_extras_compilation"
version = "0.1.0"
dependencies = [
"eframe",
"egui_extras",
]

[[package]]
name = "test_inline_glow_paint"
version = "0.1.0"
Expand Down Expand Up @@ -4208,19 +4216,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
Expand All @@ -4245,19 +4254,19 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -4268,9 +4277,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"

[[package]]
name = "wayland-backend"
Expand Down Expand Up @@ -4322,9 +4331,9 @@ dependencies = [

[[package]]
name = "wayland-protocols"
version = "0.31.2"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
checksum = "62989625a776e827cc0f15d41444a3cea5205b963c3a25be48ae1b52d6b4daaa"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
Expand All @@ -4334,9 +4343,9 @@ dependencies = [

[[package]]
name = "wayland-protocols-plasma"
version = "0.2.0"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
checksum = "f79f2d57c7fcc6ab4d602adba364bf59a5c24de57bd194486bf9b8360e06bfc4"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
Expand All @@ -4347,9 +4356,9 @@ dependencies = [

[[package]]
name = "wayland-protocols-wlr"
version = "0.2.0"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
checksum = "fd993de54a40a40fbe5601d9f1fbcaef0aebcc5fda447d7dc8f6dcbaae4f8953"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
Expand Down Expand Up @@ -4383,9 +4392,9 @@ dependencies = [

[[package]]
name = "web-sys"
version = "0.3.69"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
dependencies = [
"js-sys",
"wasm-bindgen",
Expand Down Expand Up @@ -4432,9 +4441,9 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"

[[package]]
name = "wgpu"
version = "22.0.0"
version = "22.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87e07e87a179614940ad845397e03201847453a37b43a31a3b54eee2e6e32ce"
checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433"
dependencies = [
"arrayvec",
"cfg_aliases 0.1.1",
Expand All @@ -4457,9 +4466,9 @@ dependencies = [

[[package]]
name = "wgpu-core"
version = "22.0.0"
version = "22.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0f191908a21968991463fcf3b42cb6c9648c0fb7fa301b8fc733bc21a9ed9bd"
checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a"
dependencies = [
"arrayvec",
"bit-vec 0.7.0",
Expand Down Expand Up @@ -4849,9 +4858,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

[[package]]
name = "winit"
version = "0.30.2"
version = "0.30.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dc930d6cfbf53c4fe0b95689cdc2e17b8658c3f4214b9953298ccb5a1a15c90"
checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67"
dependencies = [
"ahash",
"android-activity",
Expand Down
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ thiserror = "1.0.37"
web-time = "1.1.0" # Timekeeping for native and web
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = "0.3.58"
wgpu = { version = "22.0.0", default-features = false, features = [
web-sys = "0.3.70"
wgpu = { version = "22.1.0", default-features = false, features = [
# Make the renderer `Sync` even on wasm32, because it makes the code simpler:
"fragile-send-sync-non-atomic-wasm",
] }

# Currently can't upgrade above 0.30.2 due to https://github.com/rust-windowing/winit/issues/3837
winit = { version = "=0.30.2", default-features = false }
winit = { version = "0.30.5", default-features = false }

[workspace.lints.rust]
unsafe_code = "deny"
Expand All @@ -120,6 +118,7 @@ unused_qualifications = "allow"
[workspace.lints.rustdoc]
all = "warn"
missing_crate_level_docs = "warn"
broken_intra_doc_links = "warn"

# See also clippy.toml
[workspace.lints.clippy]
Expand Down Expand Up @@ -250,6 +249,7 @@ use_self = "warn"
useless_transmute = "warn"
verbose_file_reads = "warn"
wildcard_dependencies = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"

# TODO(emilk): enable more of these lints:
Expand All @@ -264,4 +264,3 @@ unwrap_used = "allow" # TODO(emilk): We really wanna warn on thi
manual_range_contains = "allow" # this one is just worse imho
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
significant_drop_tightening = "allow" # Too many false positives
wildcard_imports = "allow" # we do this a lot in egui
1 change: 1 addition & 0 deletions crates/ecolor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition"]

[lib]

Expand Down
2 changes: 1 addition & 1 deletion crates/ecolor/src/cint_impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::*;
use super::{linear_f32_from_linear_u8, linear_u8_from_linear_f32, Color32, Hsva, HsvaGamma, Rgba};
use cint::{Alpha, ColorInterop, EncodedSrgb, Hsv, LinearSrgb, PremultipliedAlpha};

// ---- Color32 ----
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ include = [

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg=web_sys_unstable_apis"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
rustdoc-args = ["--generate-link-to-definition"]

[lints]
workspace = true
Expand Down
2 changes: 0 additions & 2 deletions crates/eframe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ You need to either use `edition = "2021"`, or set `resolver = "2"` in the `[work

You can opt-in to the using [`egui_wgpu`](https://github.com/emilk/egui/tree/master/crates/egui_wgpu) for rendering by enabling the `wgpu` feature and setting `NativeOptions::renderer` to `Renderer::Wgpu`.

To get copy-paste working on web, you need to compile with `export RUSTFLAGS=--cfg=web_sys_unstable_apis`.

## Alternatives
`eframe` is not the only way to write an app using `egui`! You can also try [`egui-miniquad`](https://github.com/not-fl3/egui-miniquad), [`bevy_egui`](https://github.com/mvlabat/bevy_egui), [`egui_sdl2_gl`](https://github.com/ArjunNair/egui_sdl2_gl), and others.

Expand Down
Loading

0 comments on commit 821456e

Please sign in to comment.