* chore(deps): Update windows to 0.59. Update webview2-com to 0.35

* wry and other crates and objc2

* window-vibrancy 0.6

* Update windows059-webview035.md

* win compile error

* tao

* tao 0.32.1

* updatus maximus

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Fabian-Lars 2025-02-25 18:41:00 +01:00 committed by GitHub
parent ab81adb71b
commit d6520a21ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 383 additions and 990 deletions

View File

@ -0,0 +1,8 @@
---
tauri: 'minor:enhance'
tauri-runtime: 'minor:enhance'
tauri-runtime-wry: 'minor:enhance'
tauri-macos-sign: 'minor:enhance'
---
Updated `wry` to 0.50, `windows` to 0.60, `webview2-com` to 0.36, and `objc2` to 0.6. This can be a **breaking change** if you use the `with_webview` API!

1244
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -613,7 +613,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
if let Some(version_str) = &config.version {
if let Ok(v) = Version::parse(version_str) {
let version = v.major << 48 | v.minor << 32 | v.patch << 16;
let version = (v.major << 48) | (v.minor << 32) | (v.patch << 16);
res.set_version_info(VersionInfo::FILEVERSION, version);
res.set_version_info(VersionInfo::PRODUCTVERSION, version);
}

View File

@ -46,7 +46,7 @@ regex = "1"
[target."cfg(target_os = \"windows\")".dependencies]
bitness = "0.4"
windows-registry = "0.4"
windows-registry = "0.5"
glob = "0.3"
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]

View File

@ -42,7 +42,7 @@ impl CommandExt for Command {
let program = self.get_program().to_string_lossy().into_owned();
log::debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.status().map_err(Into::into)
self.status()
}
fn output_ok(&mut self) -> crate::Result<Output> {

View File

@ -698,9 +698,7 @@ impl CargoSettings {
toml_file
.read_to_string(&mut toml_str)
.with_context(|| "failed to read Cargo.toml")?;
toml::from_str(&toml_str)
.with_context(|| "failed to parse Cargo.toml")
.map_err(Into::into)
toml::from_str(&toml_str).with_context(|| "failed to parse Cargo.toml")
}
}

View File

@ -319,7 +319,7 @@ impl CommandExt for Command {
let program = self.get_program().to_string_lossy().into_owned();
log::debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.status().map_err(Into::into)
self.status()
}
fn output_ok(&mut self) -> crate::Result<Output> {

View File

@ -21,6 +21,6 @@ plist = "1"
rand = "0.8"
dirs = "6"
log = { version = "0.4.21", features = ["kv"] }
apple-codesign = "0.27"
apple-codesign = { version = "0.27", default-features = false }
chrono = "0.4"
p12 = "0.6"

View File

@ -32,7 +32,7 @@ impl CommandExt for Command {
let program = self.get_program().to_string_lossy().into_owned();
log::debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.status().map_err(Into::into)
self.status()
}
}

View File

@ -17,13 +17,13 @@ rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
wry = { version = "0.48.1", default-features = false, features = [
wry = { version = "0.50.0", default-features = false, features = [
"drag-drop",
"protocol",
"os-webview",
"linux-body",
] }
tao = { version = "0.31.0", default-features = false, features = ["rwh_06"] }
tao = { version = "0.32.1", default-features = false, features = ["rwh_06"] }
tauri-runtime = { version = "2.3.0", path = "../tauri-runtime" }
tauri-utils = { version = "2.1.1", path = "../tauri-utils" }
raw-window-handle = "0.6"
@ -33,11 +33,11 @@ tracing = { version = "0.1", optional = true }
log = "0.4.21"
[target."cfg(windows)".dependencies]
webview2-com = "0.34"
webview2-com = "0.36"
softbuffer = { version = "0.4", default-features = false }
[target."cfg(windows)".dependencies.windows]
version = "0.58"
version = "0.60"
features = ["Win32_Foundation", "Win32_Graphics_Dwm"]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
@ -46,11 +46,11 @@ webkit2gtk = { version = "=2.0", features = ["v2_40"] }
percent-encoding = "2"
[target.'cfg(target_vendor = "apple")'.dependencies]
objc2 = "0.5"
objc2 = "0.6"
[target.'cfg(target_os = "macos")'.dependencies]
objc2-foundation = { version = "0.2", features = [] }
objc2-app-kit = { version = "0.2", features = [
objc2-foundation = { version = "0.3", features = [] }
objc2-app-kit = { version = "0.3", features = [
"block2",
"NSApplication",
"NSResponder",
@ -69,7 +69,8 @@ macos-private-api = [
"wry/transparent",
"tauri-runtime/macos-private-api",
]
objc-exception = ["wry/objc-exception"]
# TODO: Remove in v3 - wry does not have this feature anymore
objc-exception = []
tracing = ["dep:tracing", "wry/tracing"]
macos-proxy = ["wry/mac-proxy"]
unstable = []

View File

@ -39,7 +39,7 @@ use tao::platform::windows::{WindowBuilderExtWindows, WindowExtWindows};
#[cfg(windows)]
use webview2_com::FocusChangedEventHandler;
#[cfg(windows)]
use windows::Win32::{Foundation::HWND, System::WinRT::EventRegistrationToken};
use windows::Win32::Foundation::HWND;
#[cfg(any(target_os = "macos", target_os = "ios"))]
use wry::WebViewBuilderExtDarwin;
#[cfg(windows)]
@ -4500,7 +4500,7 @@ fn create_webview<T: UserEvent>(
let proxy = context.proxy.clone();
let proxy_ = proxy.clone();
let window_id_ = window_id.clone();
let mut token = EventRegistrationToken::default();
let mut token = 0;
unsafe {
controller.add_GotFocus(
&FocusChangedEventHandler::create(Box::new(move |_, _| {
@ -4581,7 +4581,7 @@ fn inner_size(
if !has_children && !webviews.is_empty() {
use wry::WebViewExtMacOS;
let webview = webviews.first().unwrap();
let view = unsafe { Retained::cast::<objc2_app_kit::NSView>(webview.webview()) };
let view = unsafe { Retained::cast_unchecked::<objc2_app_kit::NSView>(webview.webview()) };
let view_frame = view.frame();
let logical: TaoLogicalSize<f64> = (view_frame.size.width, view_frame.size.height).into();
return logical.to_physical(window.scale_factor());

View File

@ -109,7 +109,7 @@ mod windows {
let parent = HWND(hwnd as _);
// return early if we already attached
if unsafe { FindWindowExW(parent, HWND::default(), CLASS_NAME, WINDOW_NAME) }.is_ok() {
if unsafe { FindWindowExW(Some(parent), None, CLASS_NAME, WINDOW_NAME) }.is_ok() {
return;
}
@ -145,9 +145,9 @@ mod windows {
0,
width,
height,
parent,
HMENU::default(),
GetModuleHandleW(PCWSTR::null()).unwrap_or_default(),
Some(parent),
None,
GetModuleHandleW(None).ok().map(|h| HINSTANCE(h.0)),
None,
)
}) else {
@ -159,7 +159,7 @@ mod windows {
let _ = SetWindowPos(
drag_window,
HWND_TOP,
Some(HWND_TOP),
0,
0,
0,
@ -190,7 +190,7 @@ mod windows {
if is_maximized(parent).unwrap_or(false) {
let _ = SetWindowPos(
child,
HWND_TOP,
Some(HWND_TOP),
0,
0,
0,
@ -205,7 +205,7 @@ mod windows {
let _ = SetWindowPos(
child,
HWND_TOP,
Some(HWND_TOP),
0,
0,
width,
@ -306,7 +306,7 @@ mod windows {
};
let _ = PostMessageW(
parent,
Some(parent),
WM_NCLBUTTONDOWN,
WPARAM(res.to_win32() as _),
LPARAM(&points as *const _ as _),
@ -325,8 +325,7 @@ mod windows {
pub fn detach_resize_handler(hwnd: isize) {
let hwnd = HWND(hwnd as _);
let Ok(child) = (unsafe { FindWindowExW(hwnd, HWND::default(), CLASS_NAME, WINDOW_NAME) })
else {
let Ok(child) = (unsafe { FindWindowExW(Some(hwnd), None, CLASS_NAME, WINDOW_NAME) }) else {
return;
};
@ -340,8 +339,8 @@ mod windows {
let hrgn1 = CreateRectRgn(0, 0, width, height);
let hrgn2 = CreateRectRgn(border_x, border_y, width - border_x, height - border_y);
CombineRgn(hrgn1, hrgn1, hrgn2, RGN_DIFF);
SetWindowRgn(hwnd, hrgn1, true);
CombineRgn(Some(hrgn1), Some(hrgn1), Some(hrgn2), RGN_DIFF);
SetWindowRgn(hwnd, Some(hrgn1), true);
}
fn is_maximized(window: HWND) -> windows::core::Result<bool> {

View File

@ -20,7 +20,7 @@ impl super::WindowExt for tao::window::Window {
mtm.alloc(),
frame,
NSWindowStyleMask::Titled,
NSBackingStoreType::NSBackingStoreBuffered,
NSBackingStoreType::Buffered,
false,
)
};

View File

@ -36,8 +36,8 @@ url = { version = "2" }
dpi = { version = "0.1", features = ["serde"] }
[target."cfg(windows)".dependencies.windows]
version = "0.58"
features = ["Win32_Foundation"]
version = "0.60"
features = ["Win32_Foundation", "Win32_System_WinRT"]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.18", features = ["v3_24"] }

View File

@ -93,9 +93,7 @@ pub struct Keys {
impl Keys {
/// Securely generate required keys for Isolation encryption.
pub fn new() -> Result<Self, Error> {
AesGcmPair::new()
.map(|aes_gcm| Self { aes_gcm })
.map_err(Into::into)
AesGcmPair::new().map(|aes_gcm| Self { aes_gcm })
}
/// The AES-GCM data (and raw data).

View File

@ -87,8 +87,8 @@ specta = { version = "^2.0.0-rc.16", optional = true, default-features = false,
# desktop
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "windows", target_os = "macos"))'.dependencies]
muda = { version = "0.15", default-features = false, features = ["serde"] }
tray-icon = { version = "0.19", default-features = false, features = [
muda = { version = "0.16", default-features = false, features = ["serde"] }
tray-icon = { version = "0.20", default-features = false, features = [
"serde",
], optional = true }
@ -101,13 +101,13 @@ webkit2gtk = { version = "=2.0.1", features = ["v2_40"] }
[target.'cfg(target_os = "macos")'.dependencies]
embed_plist = "1.2"
plist = "1"
objc2 = "0.5"
objc2-foundation = { version = "0.2", default-features = false, features = [
objc2 = "0.6"
objc2-foundation = { version = "0.3", default-features = false, features = [
"std",
"NSData",
"NSThread",
] }
objc2-app-kit = { version = "0.2", default-features = false, features = [
objc2-app-kit = { version = "0.3", default-features = false, features = [
"std",
"NSApplication",
"NSColor",
@ -116,13 +116,13 @@ objc2-app-kit = { version = "0.2", default-features = false, features = [
"NSWindow",
"NSImage",
] }
window-vibrancy = "0.5"
window-vibrancy = "0.6"
# windows
[target."cfg(windows)".dependencies]
webview2-com = "0.34"
window-vibrancy = "0.5"
windows = { version = "0.58", features = ["Win32_Foundation"] }
webview2-com = "0.36"
window-vibrancy = "0.6"
windows = { version = "0.60", features = ["Win32_Foundation"] }
# mobile
[target.'cfg(any(target_os = "android", all(target_vendor = "apple", not(target_os = "macos"))))'.dependencies]
@ -163,14 +163,14 @@ http-range = "0.1.5"
# macOS
[target.'cfg(target_os = "macos")'.dev-dependencies]
objc2-web-kit = { version = "0.2", features = [
objc2-web-kit = { version = "0.3", features = [
"objc2-app-kit",
"WKWebView",
"WKUserContentController",
] }
[features]
default = ["wry", "compression", "objc-exception", "common-controls-v6"]
default = ["wry", "compression", "common-controls-v6"]
unstable = ["tauri-runtime-wry/unstable"]
common-controls-v6 = [
"tray-icon?/common-controls-v6",
@ -181,7 +181,8 @@ tracing = ["dep:tracing", "tauri-macros/tracing", "tauri-runtime-wry/tracing"]
test = []
compression = ["tauri-macros/compression", "tauri-utils/compression"]
wry = ["tauri-runtime-wry"]
objc-exception = ["tauri-runtime-wry/objc-exception"]
# TODO: Remove in v3 - wry does not have this feature anymore
objc-exception = []
linux-libxdo = ["tray-icon/libxdo", "muda/libxdo"]
isolation = ["tauri-utils/isolation", "tauri-macros/isolation", "uuid"]
custom-protocol = ["tauri-macros/custom-protocol"]

View File

@ -220,7 +220,7 @@ pub enum RunEvent {
Resumed,
/// Emitted when all of the event loop's input events have been processed and redraw processing is about to begin.
///
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the “main body” of your event loop.
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the "main body" of your event loop.
MainEventsCleared,
/// Emitted when the user wants to open the specified resource with the app.
#[cfg(any(target_os = "macos", target_os = "ios"))]
@ -2146,7 +2146,7 @@ fn on_event_loop_event<R: Runtime>(
// set the app icon in development
#[cfg(all(dev, target_os = "macos"))]
{
use objc2::ClassType;
use objc2::AllocAnyThread;
use objc2_app_kit::{NSApplication, NSImage};
use objc2_foundation::{MainThreadMarker, NSData};

View File

@ -174,10 +174,10 @@ impl JsImage {
match self {
Self::Resource(rid) => resources_table.get::<Image<'static>>(rid),
#[cfg(any(feature = "image-ico", feature = "image-png"))]
Self::Path(path) => Image::from_path(path).map(Arc::new).map_err(Into::into),
Self::Path(path) => Image::from_path(path).map(Arc::new),
#[cfg(any(feature = "image-ico", feature = "image-png"))]
Self::Bytes(bytes) => Image::from_bytes(&bytes).map(Arc::new).map_err(Into::into),
Self::Bytes(bytes) => Image::from_bytes(&bytes).map(Arc::new),
Self::Rgba {
rgba,

View File

@ -15,7 +15,7 @@
//! - **unstable**: Enables unstable features. Be careful, it might introduce breaking changes in future minor releases.
//! - **tracing**: Enables [`tracing`](https://docs.rs/tracing/latest/tracing) for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers.
//! - **test**: Enables the [`mod@test`] module exposing unit test helpers.
//! - **objc-exception**: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust.
//! - **objc-exception**: This feature flag is no-op since 2.3.0.
//! - **linux-libxdo**: Enables linking to libxdo which enables Cut, Copy, Paste and SelectAll menu items to work on Linux.
//! - **isolation**: Enables the isolation pattern. Enabled by default if the `app > security > pattern > use` config option is set to `isolation` on the `tauri.conf.json` file.
//! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one.

View File

@ -74,7 +74,7 @@ impl<R: Runtime> ContextMenuBase for Menu<R> {
unsafe {
self_
.inner()
.show_context_menu_for_hwnd(hwnd.0 as _, position)
.show_context_menu_for_hwnd(hwnd.0 as _, position);
}
}
})

View File

@ -66,7 +66,7 @@ impl<R: Runtime> ContextMenuBase for Submenu<R> {
unsafe {
self_
.inner()
.show_context_menu_for_hwnd(hwnd.0 as _, position)
.show_context_menu_for_hwnd(hwnd.0 as _, position);
}
}
})

View File

@ -92,7 +92,7 @@ fn push_pattern<P: AsRef<Path>, F: Fn(&str) -> Result<Pattern, glob::PatternErro
// - `C:\\SomeDir`
#[cfg(windows)]
{
use std::path::{Component, Path, Prefix};
use std::path::{Component, Prefix};
let mut components = path.components();

View File

@ -1016,7 +1016,7 @@ impl<R: Runtime> Window<R> {
let window_ = self.clone();
self.run_on_main_thread(move || {
let res = webview_builder.build(window_, position, size);
tx.send(res.map_err(Into::into)).unwrap();
tx.send(res).unwrap();
})?;
rx.recv().unwrap()
}

View File

@ -163,7 +163,7 @@ mod desktop_commands {
None => None,
};
window.set_overlay_icon(value).map_err(Into::into)
window.set_overlay_icon(value)
}
#[command(root = "crate")]
@ -175,9 +175,7 @@ mod desktop_commands {
) -> crate::Result<()> {
let window = get_window(window, label)?;
let resources_table = webview.resources_table();
window
.set_icon(value.into_img(&resources_table)?.as_ref().clone())
.map_err(Into::into)
window.set_icon(value.into_img(&resources_table)?.as_ref().clone())
}
#[command(root = "crate")]