Skip to content

Commit cbd2b82

Browse files
committed
core,desktop: Update to winit v0.30.5 and latest egui from git
1 parent 9f8b891 commit cbd2b82

File tree

8 files changed

+263
-167
lines changed

8 files changed

+263
-167
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 = "9a1e358a144b5d2af9d03a80257c34883f57cf0b" }
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 = "9a1e358a144b5d2af9d03a80257c34883f57cf0b", 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 = "9a1e358a144b5d2af9d03a80257c34883f57cf0b", default-features = false, features = ["image"] }
18+
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "9a1e358a144b5d2af9d03a80257c34883f57cf0b", 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 = "9a1e358a144b5d2af9d03a80257c34883f57cf0b" }
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: 7 additions & 6 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::{ActiveEventLoop, 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,7 +43,7 @@ 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();
@@ -52,13 +52,14 @@ impl App {
5252
let preferred_height = preferences.cli.height;
5353
let start_fullscreen = preferences.cli.fullscreen;
5454

55-
let window = WindowBuilder::new()
55+
let window_attributes = WindowAttributes::default()
5656
.with_visible(false)
5757
.with_title("Ruffle")
5858
.with_window_icon(Some(icon))
5959
.with_min_inner_size(min_window_size)
60-
.with_max_inner_size(max_window_size)
61-
.build(&event_loop)?;
60+
.with_max_inner_size(max_window_size);
61+
62+
let window = event_loop.create_window(window_attributes)?;
6263
let window = Arc::new(window);
6364

6465
let mut font_database = fontdb::Database::default();

desktop/src/gui/controller.rs

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

9898
let theme_controller =
9999
ThemeController::new(window.clone(), preferences.clone(), egui_ctx.clone()).await;
100-
let mut egui_winit =
101-
egui_winit::State::new(egui_ctx, ViewportId::ROOT, window.as_ref(), None, None);
100+
let mut egui_winit = egui_winit::State::new(
101+
egui_ctx,
102+
ViewportId::ROOT,
103+
window.as_ref(),
104+
None,
105+
None,
106+
None,
107+
);
102108
egui_winit.set_max_texture_side(descriptors.limits.max_texture_dimension_2d as usize);
103109

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

desktop/src/util.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use url::Url;
88
use wgpu::rwh::{HasDisplayHandle, HasWindowHandle};
99
use winit::dpi::PhysicalSize;
1010
use winit::event::{KeyEvent, Modifiers};
11-
use winit::event_loop::EventLoop;
11+
use winit::event_loop::{ActiveEventLoop, EventLoop};
1212
use winit::keyboard::{Key, KeyLocation, NamedKey};
1313

1414
/// Converts a winit event to a Ruffle `TextControlCode`.
@@ -212,16 +212,16 @@ pub fn get_screen_size(event_loop: &EventLoop<RuffleEvent>) -> PhysicalSize<u32>
212212
let mut min_y = 0;
213213
let mut max_x = 0;
214214
let mut max_y = 0;
215-
216-
for monitor in event_loop.available_monitors() {
217-
let size = monitor.size();
218-
let position = monitor.position();
219-
min_x = min_x.min(position.x);
220-
min_y = min_y.min(position.y);
221-
max_x = max_x.max(position.x + size.width as i32);
222-
max_y = max_y.max(position.y + size.height as i32);
223-
}
224-
215+
/*
216+
for monitor in event_loop.available_monitors() {
217+
let size = monitor.size();
218+
let position = monitor.position();
219+
min_x = min_x.min(position.x);
220+
min_y = min_y.min(position.y);
221+
max_x = max_x.max(position.x + size.width as i32);
222+
max_y = max_y.max(position.y + size.height as i32);
223+
}
224+
*/
225225
let width = max_x - min_x;
226226
let height = max_y - min_y;
227227

0 commit comments

Comments
 (0)