From c8a0503f3309171bda60a7ce50ba3c67f1ab09c7 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sun, 10 Sep 2023 10:28:29 +1200 Subject: [PATCH] Update egui --- Cargo.lock | 37 ++++++++++++++++++++---------------- Cargo.toml | 8 ++++---- src/ui/mod.rs | 8 ++++++-- src/ui/theme/classic.rs | 8 +++++--- src/ui/theme/default.rs | 8 +++++--- src/ui/theme/roundy.rs | 8 +++++--- src/ui/widgets/list_entry.rs | 2 ++ 7 files changed, 48 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb5af245..a431afef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,12 +399,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" -[[package]] -name = "atomic_refcell" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79d6dc922a2792b006573f60b2648076355daeae5ce9cb59507e5908c9625d31" - [[package]] name = "atspi" version = "0.10.1" @@ -1191,7 +1185,7 @@ dependencies = [ [[package]] name = "ecolor" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "bytemuck", "serde", @@ -1200,7 +1194,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "bytemuck", "cocoa", @@ -1215,6 +1209,7 @@ dependencies = [ "js-sys", "log", "objc", + "parking_lot", "percent-encoding", "raw-window-handle", "ron", @@ -1231,7 +1226,7 @@ dependencies = [ [[package]] name = "egui" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "accesskit", "ahash 0.8.3", @@ -1262,16 +1257,16 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "accesskit_winit", "arboard", "egui", - "instant", "log", "raw-window-handle", "serde", "smithay-clipboard", + "web-time", "webbrowser", "winit", ] @@ -1279,7 +1274,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "egui", "image", @@ -1292,7 +1287,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "bytemuck", "egui", @@ -1312,7 +1307,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "emath" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "bytemuck", "serde", @@ -1362,11 +1357,10 @@ dependencies = [ [[package]] name = "epaint" version = "0.22.0" -source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391" +source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6" dependencies = [ "ab_glyph", "ahash 0.8.3", - "atomic_refcell", "bytemuck", "ecolor", "emath", @@ -4822,6 +4816,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19353897b48e2c4d849a2d73cb0aeb16dc2be4e00c565abfc11eb65a806e47de" +dependencies = [ + "js-sys", + "once_cell", + "wasm-bindgen", +] + [[package]] name = "webbrowser" version = "0.8.10" diff --git a/Cargo.toml b/Cargo.toml index ad4dfc88..21b2f413 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ rustls-tls = [ "reqwest/rustls-tls", "tungstenite/rustls-tls-webpki-roots", "tok [patch.crates-io] # override egui crate for egui_video dependency -egui = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391" } +egui = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6" } # Use the master branch of SDL2 to include a fix related to clang (and XCode after 14.2) sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2", rev = "27cd1fd67c811e06b9d997a77bb6089a1b65070d" } @@ -29,9 +29,9 @@ async-trait = "0.1" base64 = "0.21" dashmap = "5.4" dirs = "5.0" -eframe = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "persistence" ] } -egui-winit = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "default" ] } -egui_extras = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "image", "svg" ] } +eframe = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "persistence" ] } +egui-winit = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "default" ] } +egui_extras = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "image", "svg" ] } egui-video = { git = "https://github.com/mikedilger/egui-video", rev = "5a7297138dce16425c7dc7a8eab4d39d79088aba", features = [ "from_bytes" ], optional = true } encoding_rs = "0.8" fallible-iterator = "0.2" diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 6914b034..6b7681b9 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -474,7 +474,9 @@ impl GossipUi { let pixels = image_buffer.as_flat_samples(); cctx.egui_ctx.load_texture( "icon", - ImageData::Color(ColorImage::from_rgba_unmultiplied(size, pixels.as_slice())), + ImageData::Color( + ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()).into(), + ), TextureOptions::default(), // magnification, minification ) }; @@ -487,7 +489,9 @@ impl GossipUi { let pixels = image_buffer.as_flat_samples(); cctx.egui_ctx.load_texture( "placeholder_avatar", - ImageData::Color(ColorImage::from_rgba_unmultiplied(size, pixels.as_slice())), + ImageData::Color( + ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()).into(), + ), TextureOptions::default(), // magnification, minification ) }; diff --git a/src/ui/theme/classic.rs b/src/ui/theme/classic.rs index e1e4c1ee..3bf4a1c1 100644 --- a/src/ui/theme/classic.rs +++ b/src/ui/theme/classic.rs @@ -179,11 +179,12 @@ impl ThemeDef for ClassicTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } else { style.visuals = Visuals { @@ -262,11 +263,12 @@ impl ThemeDef for ClassicTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } style @@ -455,7 +457,7 @@ impl ThemeDef for ClassicTheme { // feed styling fn feed_scroll_rounding(_feed: &FeedProperties) -> Rounding { - Rounding::none() + Rounding::ZERO } fn feed_scroll_fill(dark_mode: bool, _feed: &FeedProperties) -> Color32 { if dark_mode { diff --git a/src/ui/theme/default.rs b/src/ui/theme/default.rs index f16ebee4..c3521d19 100644 --- a/src/ui/theme/default.rs +++ b/src/ui/theme/default.rs @@ -179,11 +179,12 @@ impl ThemeDef for DefaultTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } else { style.visuals = Visuals { @@ -262,11 +263,12 @@ impl ThemeDef for DefaultTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } style @@ -472,7 +474,7 @@ impl ThemeDef for DefaultTheme { // feed styling fn feed_scroll_rounding(_feed: &FeedProperties) -> Rounding { - Rounding::none() + Rounding::ZERO } fn feed_scroll_fill(_dark_mode: bool, _feed: &FeedProperties) -> Color32 { Color32::from_rgba_premultiplied(0, 0, 0, 0) // Transparent separator diff --git a/src/ui/theme/roundy.rs b/src/ui/theme/roundy.rs index 0630c372..815284c2 100644 --- a/src/ui/theme/roundy.rs +++ b/src/ui/theme/roundy.rs @@ -184,11 +184,12 @@ impl ThemeDef for RoundyTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } else { // ---- light mode ----------------------------------------------------------------------------------------- @@ -268,11 +269,12 @@ impl ThemeDef for RoundyTheme { striped: true, window_rounding: Rounding::same(6.0), resize_corner_size: 12.0, - text_cursor_width: 2.0, + text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)), text_cursor_preview: false, clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion button_frame: true, collapsing_header_frame: false, + interact_cursor: None, }; } style @@ -492,7 +494,7 @@ impl ThemeDef for RoundyTheme { } fn feed_frame_rounding(post: &NoteRenderData) -> Rounding { if post.is_thread { - let mut rounding = Rounding::none(); + let mut rounding = Rounding::ZERO; if post.is_first && post.thread_position == 0 { rounding.nw = 7.0; rounding.ne = 7.0; diff --git a/src/ui/widgets/list_entry.rs b/src/ui/widgets/list_entry.rs index 9da50b71..66359f59 100644 --- a/src/ui/widgets/list_entry.rs +++ b/src/ui/widgets/list_entry.rs @@ -45,6 +45,8 @@ pub(crate) fn paint_frame(ui: &mut Ui, rect: &Rect, fill: Option) { rounding: Rounding::same(5.0), fill, stroke: Stroke::NONE, + fill_texture_id: Default::default(), + uv: Rect::ZERO, }); }