Skip to content

Commit

Permalink
chore(deps): update tao to 0.13, wry to 0.20, rfd to 0.10, raw-window…
Browse files Browse the repository at this point in the history
…-handle to 0.5 (#4804)
  • Loading branch information
amrbashir authored Jul 31, 2022
1 parent 0983d7c commit 0ad9531
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 190 deletions.
5 changes: 5 additions & 0 deletions .changes/raw-display-handle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": "patch"
---

Implement `raw_window_handle::HasRawDisplayHandle` for `App` and `AppHandle`
4 changes: 2 additions & 2 deletions core/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ exclude = [ ".license_template", "CHANGELOG.md", "/target" ]
readme = "README.md"

[dependencies]
wry = { version = "0.19", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { version = "0.20", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.10.2", path = "../tauri-runtime" }
tauri-utils = { version = "1.0.3", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
rand = "0.8"
raw-window-handle = "0.4.3"
raw-window-handle = "0.5"

[target."cfg(windows)".dependencies]
webview2-com = "0.16.0"
Expand Down
6 changes: 5 additions & 1 deletion core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! The [`wry`] Tauri [`Runtime`].
pub use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle};
use tauri_runtime::{
http::{
Request as HttpRequest, RequestParts as HttpRequestParts, Response as HttpResponse,
Expand Down Expand Up @@ -1739,6 +1739,10 @@ impl<T: UserEvent> RuntimeHandle<T> for WryHandle<T> {
fn remove_system_tray(&self) -> Result<()> {
send_user_message(&self.context, Message::Tray(TrayMessage::Close))
}

fn raw_display_handle(&self) -> RawDisplayHandle {
self.context.main_thread.window_target.raw_display_handle()
}
}

impl<T: UserEvent> Wry<T> {
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ uuid = { version = "1", features = [ "v4" ] }
http = "0.2.4"
http-range = "0.1.4"
infer = "0.7"
raw-window-handle = "0.4.3"
raw-window-handle = "0.5"

[target."cfg(windows)".dependencies]
webview2-com = "0.16.0"
Expand Down
3 changes: 3 additions & 0 deletions core/tauri-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![cfg_attr(doc_cfg, feature(doc_cfg))]

use raw_window_handle::RawDisplayHandle;
use serde::Deserialize;
use std::{fmt::Debug, sync::mpsc::Sender};
use tauri_utils::Theme;
Expand Down Expand Up @@ -263,6 +264,8 @@ pub trait RuntimeHandle<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'st
#[cfg(all(windows, feature = "system-tray"))]
#[cfg_attr(doc_cfg, doc(cfg(all(windows, feature = "system-tray"))))]
fn remove_system_tray(&self) -> Result<()>;

fn raw_display_handle(&self) -> RawDisplayHandle;
}

/// A global shortcut manager.
Expand Down
4 changes: 2 additions & 2 deletions core/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ attohttpc = { version = "0.19", features = [ "json", "form" ], optional = true }
open = { version = "3.0", optional = true }
shared_child = { version = "1.0", optional = true }
os_pipe = { version = "1.0", optional = true }
rfd = { version = "0.9", optional = true }
raw-window-handle = "0.4.3"
rfd = { version = "0.10", optional = true }
raw-window-handle = "0.5"
minisign-verify = { version = "0.2", optional = true }
time = { version = "0.3", features = [ "parsing", "formatting" ], optional = true }
os_info = { version = "3.4.0", optional = true }
Expand Down
13 changes: 13 additions & 0 deletions core/tauri/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::{
#[cfg(shell_scope)]
use crate::scope::ShellScope;

use raw_window_handle::HasRawDisplayHandle;
use tauri_macros::default_runtime;
use tauri_runtime::window::{
dpi::{PhysicalPosition, PhysicalSize},
Expand Down Expand Up @@ -1587,6 +1588,18 @@ impl<R: Runtime> Builder<R> {
}
}

unsafe impl HasRawDisplayHandle for AppHandle {
fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
self.runtime_handle.raw_display_handle()
}
}

unsafe impl HasRawDisplayHandle for App {
fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
self.handle.raw_display_handle()
}
}

fn on_event_loop_event<R: Runtime, F: FnMut(&AppHandle<R>, RunEvent) + 'static>(
app_handle: &AppHandle<R>,
event: RuntimeRunEvent<EventLoopMessage>,
Expand Down
4 changes: 4 additions & 0 deletions core/tauri/src/test/mock_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ impl<T: UserEvent> RuntimeHandle<T> for MockRuntimeHandle {
fn remove_system_tray(&self) -> Result<()> {
Ok(())
}

fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
unimplemented!()
}
}

#[derive(Debug, Clone)]
Expand Down
Loading

0 comments on commit 0ad9531

Please sign in to comment.