Skip to content

Commit

Permalink
core,desktop: Update to winit v0.30.5 and latest egui from git
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 committed Aug 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b9054c4 commit bf978f9
Showing 8 changed files with 247 additions and 162 deletions.
350 changes: 214 additions & 136 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
naga = { version = "22.1.0", features = ["wgsl-out"] }
wgpu = "22.1.0"
egui = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf" }
egui = { git = "https://github.com/emilk/egui.git", rev = "1f6ae49a5f6bf43a869c215dea0d3028be8d742a" }
clap = { version = "4.5.13", features = ["derive"] }
anyhow = "1.0"
slotmap = "1.0.7"
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ hashbrown = { version = "0.14.5", features = ["raw"] }
scopeguard = "1.2.0"
fluent-templates = "0.9.4"
egui = { workspace = true, optional = true }
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", default-features = false, optional = true }
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "1f6ae49a5f6bf43a869c215dea0d3028be8d742a", default-features = false, optional = true }
png = { version = "0.17.13", optional = true }
flv-rs = { path = "../flv" }
async-channel = { workspace = true }
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ unknown-git = "deny"
# github.com organizations to allow git sources for
github = [
"ruffle-rs",
# TODO: Remove once a release with https://github.com/emilk/egui/pull/4847 in it is out.
# TODO: Remove once a release with https://github.com/emilk/egui/pull/4939 in it is out.
"emilk",
]

8 changes: 4 additions & 4 deletions desktop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,10 +14,10 @@ workspace = true
clap = { workspace = true }
cpal = "0.15.3"
egui = { workspace = true }
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", default-features = false, features = ["image"] }
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf", features = ["winit"] }
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "1f6ae49a5f6bf43a869c215dea0d3028be8d742a", default-features = false, features = ["image"] }
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "1f6ae49a5f6bf43a869c215dea0d3028be8d742a", features = ["winit"] }
image = { workspace = true, features = ["png"] }
egui-winit = { git = "https://github.com/emilk/egui.git", rev = "37b1e1504db14697c39ce1c3bb5e58f4f2b819bf" }
egui-winit = { git = "https://github.com/emilk/egui.git", rev = "1f6ae49a5f6bf43a869c215dea0d3028be8d742a" }
fontdb = "0.20"
ruffle_core = { path = "../core", features = ["audio", "clap", "mp3", "nellymoser", "default_compatibility_rules", "egui"] }
ruffle_render = { path = "../render", features = ["clap"] }
@@ -28,7 +28,7 @@ ruffle_frontend_utils = { path = "../frontend-utils" }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tracing-appender = "0.2.3"
winit = "0.29.15"
winit = "0.30.5"
webbrowser = "1.0.1"
url = { workspace = true }
dirs = "5.0"
13 changes: 7 additions & 6 deletions desktop/src/app.rs
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ use std::time::{Duration, Instant};
use url::Url;
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize, Size};
use winit::event::{ElementState, KeyEvent, Modifiers, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop, EventLoopBuilder};
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
use winit::keyboard::{Key, NamedKey};
use winit::window::{Fullscreen, Icon, Window, WindowBuilder};
use winit::window::{Fullscreen, Icon, Window, WindowAttributes};

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

let event_loop = EventLoopBuilder::with_user_event().build()?;
let event_loop = EventLoop::with_user_event().build()?;

let no_gui = preferences.cli.no_gui;
let min_window_size = (16, if no_gui { 16 } else { MENU_HEIGHT + 16 }).into();
@@ -52,13 +52,14 @@ impl App {
let preferred_height = preferences.cli.height;
let start_fullscreen = preferences.cli.fullscreen;

let window = WindowBuilder::new()
let window_attributes = WindowAttributes::default()
.with_visible(false)
.with_title("Ruffle")
.with_window_icon(Some(icon))
.with_min_inner_size(min_window_size)
.with_max_inner_size(max_window_size)
.build(&event_loop)?;
.with_max_inner_size(max_window_size);

let window = event_loop.create_window(window_attributes)?;
let window = Arc::new(window);

let mut font_database = fontdb::Database::default();
10 changes: 8 additions & 2 deletions desktop/src/gui/controller.rs
Original file line number Diff line number Diff line change
@@ -97,8 +97,14 @@ impl GuiController {

let theme_controller =
ThemeController::new(window.clone(), preferences.clone(), egui_ctx.clone()).await;
let mut egui_winit =
egui_winit::State::new(egui_ctx, ViewportId::ROOT, window.as_ref(), None, None);
let mut egui_winit = egui_winit::State::new(
egui_ctx,
ViewportId::ROOT,
window.as_ref(),
None,
None,
None,
);
egui_winit.set_max_texture_side(descriptors.limits.max_texture_dimension_2d as usize);

let movie_view_renderer = Arc::new(MovieViewRenderer::new(
22 changes: 11 additions & 11 deletions desktop/src/util.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
use url::Url;
use winit::dpi::PhysicalSize;
use winit::event::{KeyEvent, Modifiers};
use winit::event_loop::EventLoop;
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::keyboard::{Key, KeyLocation, NamedKey};

/// Converts a winit event to a Ruffle `TextControlCode`.
@@ -211,16 +211,16 @@ pub fn get_screen_size(event_loop: &EventLoop<RuffleEvent>) -> PhysicalSize<u32>
let mut min_y = 0;
let mut max_x = 0;
let mut max_y = 0;

for monitor in event_loop.available_monitors() {
let size = monitor.size();
let position = monitor.position();
min_x = min_x.min(position.x);
min_y = min_y.min(position.y);
max_x = max_x.max(position.x + size.width as i32);
max_y = max_y.max(position.y + size.height as i32);
}

/*
for monitor in event_loop.available_monitors() {
let size = monitor.size();
let position = monitor.position();
min_x = min_x.min(position.x);
min_y = min_y.min(position.y);
max_x = max_x.max(position.x + size.width as i32);
max_y = max_y.max(position.y + size.height as i32);
}
*/
let width = max_x - min_x;
let height = max_y - min_y;

0 comments on commit bf978f9

Please sign in to comment.