Skip to content

Commit 34be6cf

Browse files
authored
Update webview2-com and windows crates (#2875)
1 parent 348c38d commit 34be6cf

15 files changed

Lines changed: 939 additions & 619 deletions

File tree

.changes/windows-0.25.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri": patch
3+
"tauri-runtime": patch
4+
"tauri-runtime-wry": patch
5+
---
6+
7+
Update the `windows` crate to 0.25.0, which comes with pre-built libraries. WRY and Tao can both reference the same types directly from the `windows` crate instead of sharing bindings in `webview2-com-sys`.

core/tauri-runtime-wry/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@ readme = "README.md"
1414

1515
[dependencies]
1616
#wry = { version = "0.12", default-features = false, features = [ "file-drop", "protocol" ] }
17-
wry = { git = "https://github.com/tauri-apps/wry", rev = "910cc1eb8ed08c66e9fb75df90e28635538d68ab", default-features = false, features = [ "file-drop", "protocol" ] }
17+
wry = { git = "https://github.com/tauri-apps/wry", rev = "27cf3735f717ffcc409e79031356ea0c99cadf8a", default-features = false, features = [ "file-drop", "protocol" ] }
1818
tauri-runtime = { version = "0.2.1", path = "../tauri-runtime" }
1919
tauri-utils = { version = "1.0.0-beta.3", path = "../tauri-utils" }
2020
uuid = { version = "0.8.2", features = [ "v4" ] }
2121
infer = "0.4"
2222

2323
[target."cfg(windows)".dependencies]
2424
ico = "0.1"
25-
webview2-com = "0.4.0"
25+
webview2-com = "0.7.0"
26+
27+
[target."cfg(windows)".dependencies.windows]
28+
version = "0.25.0"
29+
features = [
30+
"Win32_Foundation",
31+
]
2632

2733
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
2834
png = "0.16"

core/tauri-runtime-wry/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ use tauri_runtime::window::MenuEvent;
2727
use tauri_runtime::{SystemTray, SystemTrayEvent};
2828
#[cfg(windows)]
2929
use webview2_com::{
30-
FocusChangedEventHandler,
31-
Windows::Win32::{Foundation::HWND, System::WinRT::EventRegistrationToken},
30+
FocusChangedEventHandler, Windows::Win32::System::WinRT::EventRegistrationToken,
3231
};
32+
#[cfg(windows)]
33+
use windows::Win32::Foundation::HWND;
3334
#[cfg(all(feature = "system-tray", target_os = "macos"))]
3435
use wry::application::platform::macos::{SystemTrayBuilderExtMacOS, SystemTrayExtMacOS};
3536
#[cfg(target_os = "linux")]
@@ -1676,7 +1677,7 @@ impl Runtime for Wry {
16761677
let proxy = self.event_loop.create_proxy();
16771678
let mut token = EventRegistrationToken::default();
16781679
unsafe {
1679-
controller.add_GotFocus(
1680+
controller.GotFocus(
16801681
FocusChangedEventHandler::create(Box::new(move |_, _| {
16811682
let _ = proxy.send_event(Message::Webview(
16821683
id,
@@ -1690,7 +1691,7 @@ impl Runtime for Wry {
16901691
.unwrap();
16911692
let proxy = self.event_loop.create_proxy();
16921693
unsafe {
1693-
controller.add_LostFocus(
1694+
controller.LostFocus(
16941695
FocusChangedEventHandler::create(Box::new(move |_, _| {
16951696
let _ = proxy.send_event(Message::Webview(
16961697
id,

core/tauri-runtime/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ http-range = "0.1.4"
3333
infer = "0.4"
3434

3535
[target."cfg(windows)".dependencies]
36-
webview2-com-sys = "0.4.0"
36+
webview2-com = "0.7.0"
37+
38+
[target."cfg(windows)".dependencies.windows]
39+
version = "0.25.0"
40+
features = [
41+
"Win32_Foundation",
42+
]
3743

3844
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
3945
gtk = { version = "0.14", features = [ "v3_20" ] }

core/tauri-runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{fmt::Debug, path::PathBuf, sync::mpsc::Sender};
1111
use uuid::Uuid;
1212

1313
#[cfg(windows)]
14-
use webview2_com_sys::Windows::Win32::Foundation::HWND;
14+
use windows::Win32::Foundation::HWND;
1515

1616
pub mod http;
1717
/// Create window and system tray menus.

core/tauri-runtime/src/webview.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use serde_json::Value as JsonValue;
1313
use tauri_utils::config::{WindowConfig, WindowUrl};
1414

1515
#[cfg(windows)]
16-
use webview2_com_sys::Windows::Win32::Foundation::HWND;
16+
use windows::Win32::Foundation::HWND;
1717

1818
use std::{fmt, path::PathBuf};
1919

core/tauri/scripts/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/public/build/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/public/build/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)