1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Merge branch 'lucas/atoms-preferred-size' into lucas/experiments/measure-widget-size

# Conflicts:
#	crates/egui/src/ui.rs
#	crates/egui/src/widgets/button.rs
#	crates/egui/src/widgets/label.rs
#	crates/egui_demo_lib/src/demo/popups.rs
#	crates/egui_extras/src/layout.rs
#	crates/epaint/src/text/text_layout_types.rs
This commit is contained in:
lucasmerlin
2025-06-16 09:52:22 +02:00
389 changed files with 8660 additions and 3857 deletions

View File

@@ -86,7 +86,8 @@ env_logger = { version = "0.10", default-features = false, features = [
"auto-color",
"humantime",
] }
rfd = { version = "0.15", optional = true }
mimalloc.workspace = true
rfd = { version = "0.15.3", optional = true }
# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -95,4 +96,4 @@ wasm-bindgen-futures.workspace = true
web-sys.workspace = true
[dev-dependencies]
egui_kittest = { workspace = true, features = ["eframe", "snapshot", "wgpu"] }
egui_kittest = { workspace = true, features = ["eframe", "snapshot", "wgpu"] }

View File

@@ -1,5 +1,5 @@
# egui demo app
This app demonstrates [`egui`](https://github.com/emilk/egui/) and [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe).
This app demonstrates [`egui`](https://github.com/emilk/egui/) and [`eframe`](https://github.com/emilk/egui/tree/main/crates/eframe).
View the demo app online at <https://egui.rs>.
@@ -12,7 +12,7 @@ Run it locally with `cargo run --release -p egui_demo_app`.
./scripts/build_demo_web.sh --open
```
`egui_demo_app` uses [`egui_demo_lib`](https://github.com/emilk/egui/tree/master/crates/egui_demo_lib).
`egui_demo_app` uses [`egui_demo_lib`](https://github.com/emilk/egui/tree/main/crates/egui_demo_lib).
## Running with `wgpu` backend

View File

@@ -80,7 +80,7 @@ struct RotatingTriangle {
vertex_array: glow::VertexArray,
}
#[allow(unsafe_code)] // we need unsafe code to use glow
#[expect(unsafe_code)] // we need unsafe code to use glow
impl RotatingTriangle {
fn new(gl: &glow::Context) -> Option<Self> {
use glow::HasContext as _;

View File

@@ -1,7 +1,7 @@
use std::num::NonZeroU64;
use eframe::{
egui_wgpu::wgpu::util::DeviceExt,
egui_wgpu::wgpu::util::DeviceExt as _,
egui_wgpu::{self, wgpu},
};

View File

@@ -53,7 +53,7 @@ pub struct HttpApp {
impl Default for HttpApp {
fn default() -> Self {
Self {
url: "https://raw.githubusercontent.com/emilk/egui/master/README.md".to_owned(),
url: "https://raw.githubusercontent.com/emilk/egui/main/README.md".to_owned(),
promise: Default::default(),
}
}
@@ -133,7 +133,7 @@ fn ui_url(ui: &mut egui::Ui, frame: &eframe::Frame, url: &mut String) -> bool {
ui.horizontal(|ui| {
if ui.button("Source code for this example").clicked() {
*url = format!(
"https://raw.githubusercontent.com/emilk/egui/master/{}",
"https://raw.githubusercontent.com/emilk/egui/main/{}",
file!()
);
trigger_fetch = true;

View File

@@ -110,7 +110,7 @@ impl BackendPanel {
if cfg!(debug_assertions) && cfg!(target_arch = "wasm32") {
ui.separator();
// For testing panic handling on web:
#[allow(clippy::manual_assert)]
#[expect(clippy::manual_assert)]
if ui.button("panic!()").clicked() {
panic!("intentional panic!");
}
@@ -183,7 +183,7 @@ fn integration_ui(ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
ui.label("egui running inside ");
ui.hyperlink_to(
"eframe",
"https://github.com/emilk/egui/tree/master/crates/eframe",
"https://github.com/emilk/egui/tree/main/crates/eframe",
);
ui.label(".");
});

View File

@@ -10,7 +10,7 @@ pub use wrap_app::{Anchor, WrapApp};
/// Time of day as seconds since midnight. Used for clock in demo app.
pub(crate) fn seconds_since_midnight() -> f64 {
use chrono::Timelike;
use chrono::Timelike as _;
let time = chrono::Local::now().time();
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64)
}

View File

@@ -4,6 +4,9 @@
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(clippy::never_loop)] // False positive
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; // Much faster allocator, can give 20% speedups: https://github.com/emilk/egui/pull/7029
// When compiling natively:
fn main() -> eframe::Result {
for arg in std::env::args().skip(1) {
@@ -75,7 +78,7 @@ fn start_puffin_server() {
// We can store the server if we want, but in this case we just want
// it to keep running. Dropping it closes the server, so let's not drop it!
#[allow(clippy::mem_forget)]
#[expect(clippy::mem_forget)]
std::mem::forget(puffin_server);
}
Err(err) => {

View File

@@ -14,7 +14,7 @@ pub struct WebHandle {
#[wasm_bindgen]
impl WebHandle {
/// Installs a panic hook, then returns.
#[allow(clippy::new_without_default)]
#[allow(clippy::new_without_default, clippy::allow_attributes)]
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
// Redirect [`log`] message to `console.log` and friends:

View File

@@ -134,7 +134,7 @@ impl std::fmt::Display for Anchor {
impl From<Anchor> for egui::WidgetText {
fn from(value: Anchor) -> Self {
Self::RichText(egui::RichText::new(value.to_string()))
Self::from(value.to_string())
}
}
@@ -188,7 +188,7 @@ impl WrapApp {
// This gives us image support:
egui_extras::install_image_loaders(&cc.egui_ctx);
#[allow(unused_mut)]
#[allow(unused_mut, clippy::allow_attributes)]
let mut slf = Self {
state: State::default(),

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c15a74a1b1ed3b52a53966a3df2901ca520b92fbfbd10503e32ddb8431e1467
size 335399
oid sha256:61db3807f755ac832ba069e1adaf8aeb550c88737b4907748667a271ae29863d
size 334792

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e4a90792a9876da549f3d1da9b057a078400ad15db2cc6e35f4324851137d4e
size 93115
oid sha256:21e0a6cdf175606a513ddf410ae1b873a9817305ecad403116fad3c6ff795fa3
size 92185

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d8f1046ee5d50d73a17009fd1f11f056b5828fedc62908d00730a6aa77125473
size 182900
oid sha256:3e6a383dca7e91d07df4bf501e2de13d046f04546a08d026efe3f82fc96b6e29
size 178887

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:57274cec5ee7e5522073249b931ea65ead22752aea1de40666543e765c1b6b85
size 102929
oid sha256:e2fae780123389ca0affa762a5c031b84abcdd31c7a830d485c907c8c370b006
size 100780

View File

@@ -1,7 +1,7 @@
use egui::accesskit::Role;
use egui::Vec2;
use egui_demo_app::{Anchor, WrapApp};
use egui_kittest::kittest::Queryable;
use egui_kittest::kittest::Queryable as _;
use egui_kittest::SnapshotResults;
#[test]
@@ -67,7 +67,7 @@ fn test_demo_app() {
}
// Can't use Harness::run because fractal clock keeps requesting repaints
harness.run_steps(2);
harness.run_steps(4);
results.add(harness.try_snapshot(&anchor.to_string()));
}