Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(windows): preserve monitor DPI and cross-target framework linking

Richie McIlroya20d27cc88ad
diff --git a/apps/cli/Cargo.toml b/apps/cli/Cargo.toml
index 16648093c..b4d2d76c7 100644
--- a/apps/cli/Cargo.toml
+++ b/apps/cli/Cargo.toml
@@ -54,6 +54,7 @@ windows = { workspace = true, features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_Threading",
+ "Win32_UI_HiDpi",
] }
[target.'cfg(target_os = "macos")'.dependencies]
diff --git a/apps/cli/src/main.rs b/apps/cli/src/main.rs
index f1aa88985..1342331d8 100644
--- a/apps/cli/src/main.rs
+++ b/apps/cli/src/main.rs
@@ -447,6 +447,13 @@ struct CompletionsArgs {
}
fn main() {
+ #[cfg(windows)]
+ {
+ use windows::Win32::UI::HiDpi::{PROCESS_PER_MONITOR_DPI_AWARE, SetProcessDpiAwareness};
+
+ let _ = unsafe { SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) };
+ }
+
let cli = Cli::parse();
let level_filter = cli.log_level.level_filter();
diff --git a/crates/frame-converter/build.rs b/crates/frame-converter/build.rs
index 2f12dbcee..843655dd5 100644
--- a/crates/frame-converter/build.rs
+++ b/crates/frame-converter/build.rs
@@ -1,6 +1,5 @@
fn main() {
- #[cfg(target_os = "macos")]
- {
+ if std::env::var("CARGO_CFG_TARGET_OS").is_ok_and(|target| target == "macos") {
println!("cargo:rustc-link-lib=framework=VideoToolbox");
println!("cargo:rustc-link-lib=framework=CoreVideo");
println!("cargo:rustc-link-lib=framework=CoreFoundation");