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]] [[package]]
name = "ashpd" name = "ashpd"
version = "0.8.1" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd884d7c72877a94102c3715f3b1cd09ff4fac28221add3e57cfbe25c236d093" checksum = "bfe7e0dd0ac5a401dc116ed9f9119cf9decc625600474cb41f0fc0a0050abc9a"
dependencies = [ dependencies = [
"enumflags2", "enumflags2",
"futures-channel", "futures-channel",
"futures-util", "futures-util",
"rand 0.8.5", "rand 0.8.5",
"raw-window-handle",
"serde", "serde",
"serde_repr", "serde_repr",
"tokio", "tokio",
"url", "url",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"zbus", "zbus",
] ]
@ -1729,6 +1733,15 @@ dependencies = [
"syn 2.0.77", "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]] [[package]]
name = "dlopen2" name = "dlopen2"
version = "0.7.0" version = "0.7.0"
@ -1767,6 +1780,12 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "downcast-rs"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]] [[package]]
name = "dpi" name = "dpi"
version = "0.1.1" version = "0.1.1"
@ -4167,6 +4186,7 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"block2", "block2",
"dispatch",
"libc", "libc",
"objc2", "objc2",
] ]
@ -4877,6 +4897,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "quick-xml"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "quinn" name = "quinn"
version = "0.11.5" version = "0.11.5"
@ -5251,21 +5280,20 @@ dependencies = [
[[package]] [[package]]
name = "rfd" name = "rfd"
version = "0.14.1" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a73a7337fc24366edfca76ec521f51877b114e42dab584008209cca6719251" checksum = "8af382a047821a08aa6bfc09ab0d80ff48d45d8726f7cd8e44891f7cb4a4278e"
dependencies = [ dependencies = [
"ashpd", "ashpd",
"block", "block2",
"dispatch",
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
"gtk-sys", "gtk-sys",
"js-sys", "js-sys",
"log", "log",
"objc", "objc2",
"objc-foundation", "objc2-app-kit",
"objc_id", "objc2-foundation",
"raw-window-handle", "raw-window-handle",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -8108,6 +8136,66 @@ dependencies = [
"web-sys", "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]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.70" version = "0.3.70"

@ -33,7 +33,7 @@ tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.5" }
tauri = { workspace = true, features = ["wry"] } 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] [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", "tokio",
"gtk3", "gtk3",
"common-controls-v6", "common-controls-v6",

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

@ -8,7 +8,7 @@
//! to give results back. This is particularly useful when running dialogs from the main thread. //! 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. //! 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 rfd::{AsyncFileDialog, AsyncMessageDialog};
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use tauri::{plugin::PluginApi, AppHandle, Runtime}; 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 { impl HasWindowHandle for WindowHandle {
fn window_handle( fn window_handle(
&self, &self,
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> { ) -> 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)] #[cfg(desktop)]
if let Some(parent) = d.parent { 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)); 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 { if let Some(parent) = d.parent {
dialog = dialog.set_parent(&WindowHandle(parent)); dialog = dialog.set_parent(&parent);
} }
dialog dialog

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

Loading…
Cancel
Save