Compare commits
No commits in common. "3113934a3ac276989fd15446b0400c7ef07a1225" and "5cb36d0bcc00229031c2b887e980ad0de67982d8" have entirely different histories.
3113934a3a
...
5cb36d0bcc
|
@ -42,9 +42,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.19"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611cc2ae7d2e242c457e4be7f97036b8ad9ca152b499f53faf99b1ed8fc2553f"
|
||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||
|
||||
[[package]]
|
||||
name = "alsa"
|
||||
|
@ -106,9 +106,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.18"
|
||||
version = "0.6.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||
checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
|
@ -155,9 +155,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.93"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
|
||||
checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
|
@ -324,9 +324,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.37"
|
||||
version = "1.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf"
|
||||
checksum = "67b9470d453346108f93a59222a9a1a5724db32d0a4727b7ab7ace4b4d822dc9"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
|
@ -860,9 +860,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.1"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
|
||||
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
|
||||
|
||||
[[package]]
|
||||
name = "hassle-rs"
|
||||
|
@ -960,7 +960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.15.1",
|
||||
"hashbrown 0.15.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1046,9 +1046,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.162"
|
||||
version = "0.2.161"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
|
||||
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
@ -1673,9 +1673,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
|||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "3.7.4"
|
||||
version = "3.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f"
|
||||
checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
|
@ -1881,9 +1881,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.40"
|
||||
version = "0.38.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
|
||||
checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
|
@ -1974,7 +1974,6 @@ dependencies = [
|
|||
"rubato",
|
||||
"wgpu",
|
||||
"winit",
|
||||
"winver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2101,18 +2100,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2616,15 +2615,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.52.0"
|
||||
|
@ -2939,15 +2929,6 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winver"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e0e7162b9e282fd75a0a832cce93994bdb21208d848a418cd05a5fdd9b9ab33"
|
||||
dependencies = [
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
|
@ -3007,9 +2988,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
|
|||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.23"
|
||||
version = "0.8.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f"
|
||||
checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
|
|
|
@ -22,9 +22,6 @@ rubato = "0.16"
|
|||
wgpu = "22.1"
|
||||
winit = "0.30"
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
winver = "1"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use imgui::{FontSource, MouseCursor, SuspendedContext, WindowToken};
|
|||
use imgui_wgpu::{Renderer, RendererConfig};
|
||||
use imgui_winit_support::WinitPlatform;
|
||||
use pollster::block_on;
|
||||
#[cfg(windows)]
|
||||
#[cfg(target_os = "windows")]
|
||||
use winit::platform::windows::{CornerPreference, WindowAttributesExtWindows as _};
|
||||
use winit::{
|
||||
dpi::{LogicalSize, PhysicalSize, Size},
|
||||
|
@ -23,7 +23,7 @@ pub struct WindowStateBuilder<'a> {
|
|||
impl<'a> WindowStateBuilder<'a> {
|
||||
pub fn new(event_loop: &'a ActiveEventLoop) -> Self {
|
||||
let attributes = Window::default_attributes();
|
||||
#[cfg(windows)]
|
||||
#[cfg(target_os = "windows")]
|
||||
let attributes = attributes.with_corner_preference(CornerPreference::DoNotRound);
|
||||
Self {
|
||||
event_loop,
|
||||
|
@ -58,22 +58,12 @@ pub struct WindowState {
|
|||
pub surface_desc: wgpu::SurfaceConfiguration,
|
||||
pub surface: wgpu::Surface<'static>,
|
||||
pub hidpi_factor: f64,
|
||||
pub minimized: bool,
|
||||
}
|
||||
|
||||
impl WindowState {
|
||||
fn new(event_loop: &ActiveEventLoop, attributes: WindowAttributes) -> Self {
|
||||
let backends = wgpu::Backends::PRIMARY;
|
||||
#[cfg(windows)]
|
||||
let backends = if winver::WindowsVersion::detect().is_some_and(|v| v.major >= 10) {
|
||||
// DX12 is faster than GL, so don't use GL on windows versions which support DX12.
|
||||
// When wgpu switches to default to DX12, this can be removed.
|
||||
backends - wgpu::Backends::GL
|
||||
} else {
|
||||
backends
|
||||
};
|
||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
backends,
|
||||
backends: wgpu::Backends::PRIMARY,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -115,7 +105,6 @@ impl WindowState {
|
|||
surface_desc,
|
||||
surface,
|
||||
hidpi_factor,
|
||||
minimized: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,14 +114,9 @@ impl WindowState {
|
|||
}
|
||||
|
||||
pub fn handle_resize(&mut self, size: &PhysicalSize<u32>) {
|
||||
if size.width > 0 && size.height > 0 {
|
||||
self.minimized = false;
|
||||
self.surface_desc.width = size.width;
|
||||
self.surface_desc.height = size.height;
|
||||
self.surface.configure(&self.device, &self.surface_desc);
|
||||
} else {
|
||||
self.minimized = true;
|
||||
}
|
||||
self.surface_desc.width = size.width;
|
||||
self.surface_desc.height = size.height;
|
||||
self.surface.configure(&self.device, &self.surface_desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ pub struct GameWindow {
|
|||
client: EmulatorClient,
|
||||
input_mapper: Arc<RwLock<InputMapper>>,
|
||||
proxy: EventLoopProxy<UserEvent>,
|
||||
paused_due_to_minimize: bool,
|
||||
}
|
||||
|
||||
impl GameWindow {
|
||||
|
@ -166,7 +165,6 @@ impl GameWindow {
|
|||
client,
|
||||
input_mapper,
|
||||
proxy,
|
||||
paused_due_to_minimize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,9 +181,7 @@ impl GameWindow {
|
|||
let frame = match window.surface.get_current_texture() {
|
||||
Ok(frame) => frame,
|
||||
Err(e) => {
|
||||
if !self.window.minimized {
|
||||
eprintln!("dropped frame: {e:?}");
|
||||
}
|
||||
eprintln!("dropped frame: {e:?}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -329,18 +325,7 @@ impl AppWindow for GameWindow {
|
|||
fn handle_event(&mut self, event_loop: &ActiveEventLoop, event: &Event<UserEvent>) {
|
||||
match event {
|
||||
Event::WindowEvent { event, .. } => match event {
|
||||
WindowEvent::Resized(size) => {
|
||||
self.window.handle_resize(size);
|
||||
if self.window.minimized {
|
||||
if self.client.is_running() {
|
||||
self.client.send_command(EmulatorCommand::Pause);
|
||||
self.paused_due_to_minimize = true;
|
||||
}
|
||||
} else if self.paused_due_to_minimize {
|
||||
self.client.send_command(EmulatorCommand::Resume);
|
||||
self.paused_due_to_minimize = false;
|
||||
}
|
||||
}
|
||||
WindowEvent::Resized(size) => self.window.handle_resize(size),
|
||||
WindowEvent::CloseRequested => event_loop.exit(),
|
||||
WindowEvent::RedrawRequested => self.draw(event_loop),
|
||||
_ => (),
|
||||
|
|
|
@ -73,9 +73,7 @@ impl InputWindow {
|
|||
let frame = match window.surface.get_current_texture() {
|
||||
Ok(frame) => frame,
|
||||
Err(e) => {
|
||||
if !self.window.minimized {
|
||||
eprintln!("dropped frame: {e:?}");
|
||||
}
|
||||
eprintln!("dropped frame: {e:?}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue