Update wry, now webview scales with screen zoom

This commit is contained in:
Tim-Paik 2022-05-07 20:23:43 +08:00
parent c1577c5450
commit d561b97018
Signed by: Tim-Paik
GPG Key ID: DC36A050DB42566D
5 changed files with 16 additions and 16 deletions

8
Cargo.lock generated
View File

@ -1784,9 +1784,9 @@ dependencies = [
[[package]]
name = "tao"
version = "0.8.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3765f329d831aa461cd3f0f94b065a9fe37560fd7f8099d5bcf3e95c923071f0"
checksum = "1fd55783f88aafed0c5510ae540716455297f4f6df08f8114dc9fddc37d76ee3"
dependencies = [
"bitflags",
"cairo-rs",
@ -2267,9 +2267,9 @@ dependencies = [
[[package]]
name = "wry"
version = "0.15.1"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20b69cff9f50bab10b42e51bac9c2cf695484059f1b19e911754477ae703ef42"
checksum = "6ca96d1cadf815f81c060c516a6a1f95937e6104672a6f2117826c2b9941628a"
dependencies = [
"block",
"cocoa",

View File

@ -10,7 +10,7 @@ neutauri_data = {path = "../neutauri_data", features = ["bundler"]}
new_mime_guess = "4.0"
serde = {version = "1.0", features = ["derive"]}
toml = "0.5"
wry = {version = "0.15", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen", "devtools"]}
wry = {version = "0.16", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen", "devtools"]}
[target.'cfg(windows)'.dependencies]
rcedit = {git = "https://github.com/Tim-Paik/rcedit-rs.git", rev = "2805fca"}

View File

@ -10,7 +10,7 @@ image = {version = "0.24", optional = true}
new_mime_guess = {version = "4.0", optional = true}
serde = {version = "1.0", features = ["derive"]}
toml = {version = "0.5", optional = true}
wry = {version = "0.15", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen"]}
wry = {version = "0.16", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen"]}
[features]
bundler = ["new_mime_guess", "toml", "image"]

View File

@ -5,7 +5,7 @@ version = "0.1.0"
[dependencies]
neutauri_data = {path = "../neutauri_data", features = ["runtime"]}
wry = {version = "0.15", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen"]}
wry = {version = "0.16", default-features = false, features = ["protocol", "tray", "gtk-tray", "transparent", "fullscreen"]}
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

View File

@ -58,15 +58,14 @@ fn main() -> wry::Result<()> {
)?)),
None => window_builder,
};
let monitor_size = event_loop
.primary_monitor()
.unwrap_or_else(|| {
let monitor = event_loop.primary_monitor().unwrap_or_else(|| {
event_loop
.available_monitors()
.next()
.expect("no monitor found")
})
.size();
});
let monitor_size = monitor.size();
let monitor_scale_factor = monitor.scale_factor();
let window_builder = match res.window_attr.inner_size {
Some(size) => window_builder.with_inner_size(get_size(size, monitor_size)),
None => window_builder,
@ -169,6 +168,7 @@ fn main() -> wry::Result<()> {
})
.with_devtools(false)
.build()?;
webview.zoom(monitor_scale_factor);
event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Wait;