Skip to content

Commit 490c02b

Browse files
committed
core,desktop: Update to winit v0.30.5 and latest egui from git
1 parent 0adbf65 commit 490c02b

File tree

13 files changed

+267
-190
lines changed

13 files changed

+267
-190
lines changed

Cargo.lock

Lines changed: 215 additions & 150 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tracing = "0.1.40"
5050
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
5151
naga = { version = "22.1.0", features = ["wgsl-out"] }
5252
wgpu = "22.1.0"
53-
egui = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf" }
53+
egui = { git = "https://github.com/emilk/egui.git", rev = "f4697bc007447c6c2674beb4e25f599fb7afa093" }
5454
clap = { version = "4.5.17", features = ["derive"] }
5555
anyhow = "1.0"
5656
slotmap = "1.0.7"

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ hashbrown = { version = "0.14.5", features = ["raw"] }
5555
scopeguard = "1.2.0"
5656
fluent-templates = "0.10.1"
5757
egui = { workspace = true, optional = true }
58-
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", default-features = false, optional = true }
58+
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "f4697bc007447c6c2674beb4e25f599fb7afa093", default-features = false, optional = true }
5959
png = { version = "0.17.13", optional = true }
6060
flv-rs = { path = "../flv" }
6161
async-channel = { workspace = true }

core/src/debug_ui/display_object.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl DisplayObjectWindow {
250250
ui.label("Focus Rect");
251251
let focus_rect = object.focus_rect();
252252
let mut new_focus_rect = focus_rect;
253-
ComboBox::from_id_source(ui.id().with("focus_rect"))
253+
ComboBox::from_id_salt(ui.id().with("focus_rect"))
254254
.selected_text(optional_boolean_switch_value(focus_rect))
255255
.show_ui(ui, |ui| {
256256
for value in [None, Some(true), Some(false)] {
@@ -395,7 +395,7 @@ impl DisplayObjectWindow {
395395
ui.label("Autosize");
396396
ui.horizontal(|ui| {
397397
let mut autosize = object.autosize();
398-
ComboBox::from_id_source(ui.id().with("autosize"))
398+
ComboBox::from_id_salt(ui.id().with("autosize"))
399399
.selected_text(format!("{:?}", autosize))
400400
.show_ui(ui, |ui| {
401401
for value in [
@@ -476,7 +476,7 @@ impl DisplayObjectWindow {
476476
});
477477

478478
CollapsingHeader::new("Span List")
479-
.id_source(ui.id().with("spans"))
479+
.id_salt(ui.id().with("spans"))
480480
.show(ui, |ui| {
481481
Grid::new(ui.id().with("spans"))
482482
.num_columns(7)
@@ -598,7 +598,7 @@ impl DisplayObjectWindow {
598598
});
599599

600600
CollapsingHeader::new("Frame List")
601-
.id_source(ui.id().with("frames"))
601+
.id_salt(ui.id().with("frames"))
602602
.show(ui, |ui| {
603603
Grid::new(ui.id().with("frames"))
604604
.num_columns(5)
@@ -715,7 +715,7 @@ impl DisplayObjectWindow {
715715
"automatic"
716716
};
717717
CollapsingHeader::new(format!("Tab Order ({})", tab_order_suffix))
718-
.id_source(ui.id().with("tab_order"))
718+
.id_salt(ui.id().with("tab_order"))
719719
.show(ui, |ui| {
720720
Grid::new(ui.id().with("tab_order_grid"))
721721
.num_columns(3)
@@ -877,7 +877,7 @@ impl DisplayObjectWindow {
877877
ui.label("Blend mode");
878878
let old_blend = object.blend_mode();
879879
let mut new_blend = old_blend;
880-
ComboBox::from_id_source(ui.id().with("blendmode"))
880+
ComboBox::from_id_salt(ui.id().with("blendmode"))
881881
.selected_text(blend_mode_name(old_blend))
882882
.show_ui(ui, |ui| {
883883
for mode in ALL_BLEND_MODES {
@@ -921,7 +921,7 @@ impl DisplayObjectWindow {
921921
let filters = object.filters();
922922
if !filters.is_empty() {
923923
CollapsingHeader::new(format!("Filters ({})", filters.len()))
924-
.id_source(ui.id().with("filters"))
924+
.id_salt(ui.id().with("filters"))
925925
.show(ui, |ui| {
926926
for filter in filters {
927927
ui.label(format!("{:?}", filter));

core/src/debug_ui/domain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl DomainListWindow {
6363
}
6464

6565
CollapsingHeader::new(format!("Class {class_name}"))
66-
.id_source(ui.id().with(class.0.as_ptr()))
66+
.id_salt(ui.id().with(class.0.as_ptr()))
6767
.show(ui, |ui| {
6868
for class_obj in &*class.class_objects() {
6969
let button = ui.button(format!("{class_obj:?}"));

core/src/debug_ui/movie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl MovieWindow {
229229

230230
if !movie.parameters().is_empty() {
231231
CollapsingHeader::new("Parameters")
232-
.id_source(ui.id().with("parameters"))
232+
.id_salt(ui.id().with("parameters"))
233233
.default_open(false)
234234
.show(ui, |ui| {
235235
Grid::new(ui.id().with("parameters"))

deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ unknown-git = "deny"
7777
# github.com organizations to allow git sources for
7878
github = [
7979
"ruffle-rs",
80-
# TODO: Remove once a release with https://github.com/emilk/egui/pull/4847 in it is out.
80+
# TODO: Remove once a release with https://github.com/emilk/egui/pull/4939 in it is out.
8181
"emilk",
8282
# TODO: Remove once a release with https://github.com/PolyMeilex/rfd/pull/209 in it is out.
8383
"PolyMeilex",

desktop/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ workspace = true
1414
clap = { workspace = true }
1515
cpal = "0.15.3"
1616
egui = { workspace = true }
17-
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", default-features = false, features = ["image"] }
18-
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", features = ["winit"] }
17+
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "f4697bc007447c6c2674beb4e25f599fb7afa093", default-features = false, features = ["image"] }
18+
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "f4697bc007447c6c2674beb4e25f599fb7afa093", features = ["winit"] }
1919
image = { workspace = true, features = ["png"] }
20-
egui-winit = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf" }
20+
egui-winit = { git = "https://github.com/emilk/egui.git", rev = "f4697bc007447c6c2674beb4e25f599fb7afa093" }
2121
fontdb = "0.21"
2222
ruffle_core = { path = "../core", features = ["audio", "clap", "mp3", "nellymoser", "default_compatibility_rules", "egui"] }
2323
ruffle_render = { path = "../render", features = ["clap"] }
@@ -28,7 +28,7 @@ ruffle_frontend_utils = { path = "../frontend-utils" }
2828
tracing = { workspace = true }
2929
tracing-subscriber = { workspace = true }
3030
tracing-appender = "0.2.3"
31-
winit = "0.29.15"
31+
winit = "0.30.5"
3232
webbrowser = "1.0.1"
3333
url = { workspace = true }
3434
dirs = "5.0"

desktop/src/app.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use std::time::{Duration, Instant};
1717
use url::Url;
1818
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize, Size};
1919
use winit::event::{ElementState, KeyEvent, Modifiers, WindowEvent};
20-
use winit::event_loop::{ControlFlow, EventLoop, EventLoopBuilder};
20+
use winit::event_loop::{ControlFlow, EventLoop};
2121
use winit::keyboard::{Key, NamedKey};
22-
use winit::window::{Fullscreen, Icon, Window, WindowBuilder};
22+
use winit::window::{Fullscreen, Icon, Window, WindowAttributes};
2323

2424
pub struct App {
2525
preferences: GlobalPreferences,
@@ -43,22 +43,26 @@ impl App {
4343
let icon =
4444
Icon::from_rgba(icon_bytes.to_vec(), 32, 32).context("Couldn't load app icon")?;
4545

46-
let event_loop = EventLoopBuilder::with_user_event().build()?;
46+
let event_loop = EventLoop::with_user_event().build()?;
4747

4848
let no_gui = preferences.cli.no_gui;
4949
let min_window_size = (16, if no_gui { 16 } else { MENU_HEIGHT + 16 }).into();
50-
let max_window_size = get_screen_size(&event_loop);
5150
let preferred_width = preferences.cli.width;
5251
let preferred_height = preferences.cli.height;
5352
let start_fullscreen = preferences.cli.fullscreen;
5453

55-
let window = WindowBuilder::new()
54+
let window_attributes = WindowAttributes::default()
5655
.with_visible(false)
5756
.with_title("Ruffle")
5857
.with_window_icon(Some(icon))
59-
.with_min_inner_size(min_window_size)
60-
.with_max_inner_size(max_window_size)
61-
.build(&event_loop)?;
58+
.with_min_inner_size(min_window_size);
59+
60+
// TODO: Migrate to ActiveEventLoop::create_window, see:
61+
// https://github.com/rust-windowing/winit/releases/tag/v0.30.0
62+
#[allow(deprecated)]
63+
let window = event_loop.create_window(window_attributes)?;
64+
let max_window_size = get_screen_size(&window);
65+
window.set_max_inner_size(Some(max_window_size));
6266
let window = Arc::new(window);
6367

6468
let mut font_database = fontdb::Database::default();
@@ -136,6 +140,9 @@ impl App {
136140
// Poll UI events.
137141
let event_loop = self.event_loop.take().expect("App already running");
138142
let event_loop_proxy = event_loop.create_proxy();
143+
// TODO: Migrate to `EventLoop::run_app` and `impl ApplicationHandler<RuffleEvent> for App`,
144+
// see: https://github.com/rust-windowing/winit/releases/tag/v0.30.0
145+
#[allow(deprecated)]
139146
event_loop.run(move |event, elwt| {
140147
let mut check_redraw = false;
141148
match event {

desktop/src/gui/controller.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ impl GuiController {
9999

100100
let theme_controller =
101101
ThemeController::new(window.clone(), preferences.clone(), egui_ctx.clone()).await;
102-
let mut egui_winit =
103-
egui_winit::State::new(egui_ctx, ViewportId::ROOT, window.as_ref(), None, None);
102+
let mut egui_winit = egui_winit::State::new(
103+
egui_ctx,
104+
ViewportId::ROOT,
105+
window.as_ref(),
106+
None,
107+
None,
108+
None,
109+
);
104110
egui_winit.set_max_texture_side(descriptors.limits.max_texture_dimension_2d as usize);
105111

106112
let movie_view_renderer = Arc::new(MovieViewRenderer::new(

0 commit comments

Comments
 (0)