mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-12 19:22:34 +00:00
* Issue #324: vendor winit 0.30.13 as published The crate as released on crates.io, without its asset files (docs/res/*.svg and examples/data/*.png, AGENTS.md §1). Not used yet: the next commit patches it and adds it to [patch.crates-io]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Issue #324: on Windows 11, a window dragged to another monitor takes its scale winit 0.30.13 handles WM_DPICHANGED by checking that the new window rect is on the monitor `MonitorFromWindow` names. During a drag that is still the monitor being left, so winit nudged the window back onto it, which sent another WM_DPICHANGED: the window grew and stayed on the wrong monitor at the wrong scale. From Windows 11 (build 22000) on, apply the rect Windows suggests, as winit master does since 488c036a (rust-windowing/winit#4341); no 0.30 release has it. Windows 10 keeps the old adjustment, as on winit master. The vendored copy goes in [patch.crates-io]; a test fails if winit resolves from crates.io again or the vendored copy loses the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
2.1 KiB
Rust
79 lines
2.1 KiB
Rust
use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoModeHandle as RootVideoModeHandle};
|
|
use crate::window::Fullscreen as RootFullscreen;
|
|
|
|
#[cfg(android_platform)]
|
|
mod android;
|
|
#[cfg(ios_platform)]
|
|
mod ios;
|
|
#[cfg(any(x11_platform, wayland_platform))]
|
|
mod linux;
|
|
#[cfg(macos_platform)]
|
|
mod macos;
|
|
#[cfg(orbital_platform)]
|
|
mod orbital;
|
|
#[cfg(web_platform)]
|
|
mod web;
|
|
#[cfg(windows_platform)]
|
|
mod windows;
|
|
|
|
#[cfg(android_platform)]
|
|
use android as platform;
|
|
#[cfg(ios_platform)]
|
|
use ios as platform;
|
|
#[cfg(any(x11_platform, wayland_platform))]
|
|
use linux as platform;
|
|
#[cfg(macos_platform)]
|
|
use macos as platform;
|
|
#[cfg(orbital_platform)]
|
|
use orbital as platform;
|
|
#[cfg(web_platform)]
|
|
use web as platform;
|
|
#[cfg(windows_platform)]
|
|
use windows as platform;
|
|
|
|
pub use self::platform::*;
|
|
|
|
/// Helper for converting between platform-specific and generic
|
|
/// [`VideoModeHandle`]/[`MonitorHandle`]
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub(crate) enum Fullscreen {
|
|
Exclusive(VideoModeHandle),
|
|
Borderless(Option<MonitorHandle>),
|
|
}
|
|
|
|
impl From<RootFullscreen> for Fullscreen {
|
|
fn from(f: RootFullscreen) -> Self {
|
|
match f {
|
|
RootFullscreen::Exclusive(mode) => Self::Exclusive(mode.video_mode),
|
|
RootFullscreen::Borderless(Some(handle)) => Self::Borderless(Some(handle.inner)),
|
|
RootFullscreen::Borderless(None) => Self::Borderless(None),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<Fullscreen> for RootFullscreen {
|
|
fn from(f: Fullscreen) -> Self {
|
|
match f {
|
|
Fullscreen::Exclusive(video_mode) => {
|
|
Self::Exclusive(RootVideoModeHandle { video_mode })
|
|
},
|
|
Fullscreen::Borderless(Some(inner)) => {
|
|
Self::Borderless(Some(RootMonitorHandle { inner }))
|
|
},
|
|
Fullscreen::Borderless(None) => Self::Borderless(None),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(all(
|
|
not(ios_platform),
|
|
not(windows_platform),
|
|
not(macos_platform),
|
|
not(android_platform),
|
|
not(x11_platform),
|
|
not(wayland_platform),
|
|
not(web_platform),
|
|
not(orbital_platform),
|
|
))]
|
|
compile_error!("The platform you're compiling for is not supported by winit");
|