Skip to content

Commit

Permalink
feat(core): Implement HasDisplayHandle for Window (#9214)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Mar 19, 2024
1 parent 43230cb commit 75f5cb4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/core-window-hasdisplayhandle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tauri: 'patch:enhance'
---

`tauri::Window` and `tauri::WebviewWindow` now implement `raw_window_handle::HasDisplayHandle`.
8 changes: 8 additions & 0 deletions core/tauri/src/webview/webview_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,14 @@ impl<R: Runtime> raw_window_handle::HasWindowHandle for WebviewWindow<R> {
}
}

impl<R: Runtime> raw_window_handle::HasDisplayHandle for WebviewWindow<R> {
fn display_handle(
&self,
) -> std::result::Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
self.webview.app_handle.display_handle()
}
}

impl<'de, R: Runtime> CommandArg<'de, R> for WebviewWindow<R> {
/// Grabs the [`Window`] from the [`CommandItem`]. This will never fail.
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError> {
Expand Down
8 changes: 8 additions & 0 deletions core/tauri/src/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,14 @@ impl<R: Runtime> raw_window_handle::HasWindowHandle for Window<R> {
}
}

impl<R: Runtime> raw_window_handle::HasDisplayHandle for Window<R> {
fn display_handle(
&self,
) -> std::result::Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
self.app_handle.display_handle()
}
}

impl<R: Runtime> Clone for Window<R> {
fn clone(&self) -> Self {
Self {
Expand Down

0 comments on commit 75f5cb4

Please sign in to comment.