fix(deps): update rust crate rfd to 0.15 (v2) (#1805)

* fix(deps): update rust crate rfd to 0.15

* Fix compilation

* Add change file

* Remove platform specific note

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
pull/1813/head
renovate[bot] 9 months ago committed by GitHub
parent 41fe9053a0
commit 6bf1bd8d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"dialog": patch
---
Update rfd to 0.15

106
Cargo.lock generated

@ -341,18 +341,22 @@ checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
[[package]]
name = "ashpd"
version = "0.8.1"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd884d7c72877a94102c3715f3b1cd09ff4fac28221add3e57cfbe25c236d093"
checksum = "bfe7e0dd0ac5a401dc116ed9f9119cf9decc625600474cb41f0fc0a0050abc9a"
dependencies = [
"enumflags2",
"futures-channel",
"futures-util",
"rand 0.8.5",
"raw-window-handle",
"serde",
"serde_repr",
"tokio",
"url",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"zbus",
]
@ -1729,6 +1733,15 @@ dependencies = [
"syn 2.0.77",
]
[[package]]
name = "dlib"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
]
[[package]]
name = "dlopen2"
version = "0.7.0"
@ -1767,6 +1780,12 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "downcast-rs"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dpi"
version = "0.1.1"
@ -4167,6 +4186,7 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
dependencies = [
"bitflags 2.6.0",
"block2",
"dispatch",
"libc",
"objc2",
]
@ -4877,6 +4897,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc"
dependencies = [
"memchr",
]
[[package]]
name = "quinn"
version = "0.11.5"
@ -5251,21 +5280,20 @@ dependencies = [
[[package]]
name = "rfd"
version = "0.14.1"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a73a7337fc24366edfca76ec521f51877b114e42dab584008209cca6719251"
checksum = "8af382a047821a08aa6bfc09ab0d80ff48d45d8726f7cd8e44891f7cb4a4278e"
dependencies = [
"ashpd",
"block",
"dispatch",
"block2",
"glib-sys",
"gobject-sys",
"gtk-sys",
"js-sys",
"log",
"objc",
"objc-foundation",
"objc_id",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"raw-window-handle",
"wasm-bindgen",
"wasm-bindgen-futures",
@ -8108,6 +8136,66 @@ dependencies = [
"web-sys",
]
[[package]]
name = "wayland-backend"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6"
dependencies = [
"cc",
"downcast-rs",
"rustix",
"scoped-tls",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-client"
version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d"
dependencies = [
"bitflags 2.6.0",
"rustix",
"wayland-backend",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols"
version = "0.32.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b5755d77ae9040bb872a25026555ce4cb0ae75fd923e90d25fba07d81057de0"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3"
dependencies = [
"proc-macro2",
"quick-xml 0.36.1",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09"
dependencies = [
"dlib",
"log",
"pkg-config",
]
[[package]]
name = "web-sys"
version = "0.3.70"

@ -33,7 +33,7 @@ tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.5" }
tauri = { workspace = true, features = ["wry"] }
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
rfd = { version = "0.14", default-features = false, features = [
rfd = { version = "0.15", default-features = false, features = [
"tokio",
"gtk3",
"common-controls-v6",

@ -205,7 +205,7 @@ pub(crate) async fn save<R: Runtime>(
options: SaveDialogOptions,
) -> Result<Option<FilePath>> {
let mut dialog_builder = dialog.file();
#[cfg(any(windows, target_os = "macos"))]
#[cfg(desktop)]
{
dialog_builder = dialog_builder.set_parent(&window);
}
@ -253,7 +253,7 @@ fn message_dialog<R: Runtime>(
builder = builder.title(title);
}
#[cfg(any(windows, target_os = "macos"))]
#[cfg(desktop)]
{
builder = builder.parent(&window);
}

@ -8,7 +8,7 @@
//! to give results back. This is particularly useful when running dialogs from the main thread.
//! When using on asynchronous contexts such as async commands, the [`blocking`] APIs are recommended.
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle};
use rfd::{AsyncFileDialog, AsyncMessageDialog};
use serde::de::DeserializeOwned;
use tauri::{plugin::PluginApi, AppHandle, Runtime};
@ -50,13 +50,34 @@ impl From<MessageDialogKind> for rfd::MessageLevel {
}
}
struct WindowHandle(RawWindowHandle);
#[derive(Debug)]
pub(crate) struct WindowHandle {
window_handle: RawWindowHandle,
display_handle: RawDisplayHandle,
}
impl WindowHandle {
pub(crate) fn new(window_handle: RawWindowHandle, display_handle: RawDisplayHandle) -> Self {
Self {
window_handle,
display_handle,
}
}
}
impl HasWindowHandle for WindowHandle {
fn window_handle(
&self,
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> {
Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.0) })
Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.window_handle) })
}
}
impl HasDisplayHandle for WindowHandle {
fn display_handle(
&self,
) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
Ok(unsafe { raw_window_handle::DisplayHandle::borrow_raw(self.display_handle) })
}
}
@ -79,7 +100,7 @@ impl<R: Runtime> From<FileDialogBuilder<R>> for AsyncFileDialog {
}
#[cfg(desktop)]
if let Some(parent) = d.parent {
builder = builder.set_parent(&WindowHandle(parent));
builder = builder.set_parent(&parent);
}
builder = builder.set_can_create_directories(d.can_create_directories.unwrap_or(true));
@ -106,7 +127,7 @@ impl<R: Runtime> From<MessageDialogBuilder<R>> for AsyncMessageDialog {
}
if let Some(parent) = d.parent {
dialog = dialog.set_parent(&WindowHandle(parent));
dialog = dialog.set_parent(&parent);
}
dialog

@ -199,7 +199,7 @@ pub struct MessageDialogBuilder<R: Runtime> {
pub(crate) ok_button_label: Option<String>,
pub(crate) cancel_button_label: Option<String>,
#[cfg(desktop)]
pub(crate) parent: Option<raw_window_handle::RawWindowHandle>,
pub(crate) parent: Option<crate::desktop::WindowHandle>,
}
/// Payload for the message dialog mobile API.
@ -250,14 +250,18 @@ impl<R: Runtime> MessageDialogBuilder<R> {
}
/// Set parent windows explicitly (optional)
///
/// ## Platform-specific
///
/// - **Linux:** Unsupported.
#[cfg(desktop)]
pub fn parent<W: raw_window_handle::HasWindowHandle>(mut self, parent: &W) -> Self {
if let Ok(h) = parent.window_handle() {
self.parent.replace(h.as_raw());
pub fn parent<W: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle>(
mut self,
parent: &W,
) -> Self {
if let (Ok(window_handle), Ok(display_handle)) =
(parent.window_handle(), parent.display_handle())
{
self.parent.replace(crate::desktop::WindowHandle::new(
window_handle.as_raw(),
display_handle.as_raw(),
));
}
self
}
@ -314,7 +318,7 @@ pub struct FileDialogBuilder<R: Runtime> {
pub(crate) title: Option<String>,
pub(crate) can_create_directories: Option<bool>,
#[cfg(desktop)]
pub(crate) parent: Option<raw_window_handle::RawWindowHandle>,
pub(crate) parent: Option<crate::desktop::WindowHandle>,
}
#[cfg(mobile)]
@ -380,9 +384,19 @@ impl<R: Runtime> FileDialogBuilder<R> {
/// Sets the parent window of the dialog.
#[cfg(desktop)]
#[must_use]
pub fn set_parent<W: raw_window_handle::HasWindowHandle>(mut self, parent: &W) -> Self {
if let Ok(h) = parent.window_handle() {
self.parent.replace(h.as_raw());
pub fn set_parent<
W: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
>(
mut self,
parent: &W,
) -> Self {
if let (Ok(window_handle), Ok(display_handle)) =
(parent.window_handle(), parent.display_handle())
{
self.parent.replace(crate::desktop::WindowHandle::new(
window_handle.as_raw(),
display_handle.as_raw(),
));
}
self
}

Loading…
Cancel
Save