Skip to content

Commit 4dd9d1e

Browse files
committed
core,desktop: Update to winit v0.30.5 and latest egui from git
1 parent 713224c commit 4dd9d1e

File tree

8 files changed

+259
-162
lines changed

8 files changed

+259
-162
lines changed

Cargo.lock

Lines changed: 230 additions & 141 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 = "58bc67e02f49de4f8afd820bc3b7e74734d81d4b" }
5454
clap = { version = "4.5.16", 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 = "58bc67e02f49de4f8afd820bc3b7e74734d81d4b", default-features = false, optional = true }
5959
png = { version = "0.17.13", optional = true }
6060
flv-rs = { path = "../flv" }
6161
async-channel = { workspace = true }

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 = "58bc67e02f49de4f8afd820bc3b7e74734d81d4b", default-features = false, features = ["image"] }
18+
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "58bc67e02f49de4f8afd820bc3b7e74734d81d4b", 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 = "58bc67e02f49de4f8afd820bc3b7e74734d81d4b" }
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: 11 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,24 @@ 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+
#[allow(deprecated)]
61+
let window = event_loop.create_window(window_attributes)?;
62+
let max_window_size = get_screen_size(&window);
63+
window.set_max_inner_size(Some(max_window_size));
6264
let window = Arc::new(window);
6365

6466
let mut font_database = fontdb::Database::default();
@@ -136,6 +138,7 @@ impl App {
136138
// Poll UI events.
137139
let event_loop = self.event_loop.take().expect("App already running");
138140
let event_loop_proxy = event_loop.create_proxy();
141+
#[allow(deprecated)]
139142
event_loop.run(move |event, elwt| {
140143
let mut check_redraw = false;
141144
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(

desktop/src/util.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
use crate::custom_event::RuffleEvent;
21
use anyhow::{anyhow, Error};
32
use gilrs::Button;
43
use ruffle_core::events::{GamepadButton, KeyCode, TextControlCode};
54
use std::path::Path;
65
use url::Url;
76
use winit::dpi::PhysicalSize;
87
use winit::event::{KeyEvent, Modifiers};
9-
use winit::event_loop::EventLoop;
108
use winit::keyboard::{Key, KeyLocation, NamedKey};
9+
use winit::window::Window;
1110

1211
/// Converts a winit event to a Ruffle `TextControlCode`.
1312
/// Returns `None` if there is no match.
@@ -205,13 +204,13 @@ pub fn gilrs_button_to_gamepad_button(button: Button) -> Option<GamepadButton> {
205204
}
206205
}
207206

208-
pub fn get_screen_size(event_loop: &EventLoop<RuffleEvent>) -> PhysicalSize<u32> {
207+
pub fn get_screen_size(window: &Window) -> PhysicalSize<u32> {
209208
let mut min_x = 0;
210209
let mut min_y = 0;
211210
let mut max_x = 0;
212211
let mut max_y = 0;
213212

214-
for monitor in event_loop.available_monitors() {
213+
for monitor in window.available_monitors() {
215214
let size = monitor.size();
216215
let position = monitor.position();
217216
min_x = min_x.min(position.x);

0 commit comments

Comments
 (0)