Skip to content

Commit 75f5cb4

Browse files
authored
feat(core): Implement HasDisplayHandle for Window (#9214)
1 parent 43230cb commit 75f5cb4

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
tauri: 'patch:enhance'
3+
---
4+
5+
`tauri::Window` and `tauri::WebviewWindow` now implement `raw_window_handle::HasDisplayHandle`.

core/tauri/src/webview/webview_window.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,14 @@ impl<R: Runtime> raw_window_handle::HasWindowHandle for WebviewWindow<R> {
876876
}
877877
}
878878

879+
impl<R: Runtime> raw_window_handle::HasDisplayHandle for WebviewWindow<R> {
880+
fn display_handle(
881+
&self,
882+
) -> std::result::Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
883+
self.webview.app_handle.display_handle()
884+
}
885+
}
886+
879887
impl<'de, R: Runtime> CommandArg<'de, R> for WebviewWindow<R> {
880888
/// Grabs the [`Window`] from the [`CommandItem`]. This will never fail.
881889
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError> {

core/tauri/src/window/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,14 @@ impl<R: Runtime> raw_window_handle::HasWindowHandle for Window<R> {
885885
}
886886
}
887887

888+
impl<R: Runtime> raw_window_handle::HasDisplayHandle for Window<R> {
889+
fn display_handle(
890+
&self,
891+
) -> std::result::Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
892+
self.app_handle.display_handle()
893+
}
894+
}
895+
888896
impl<R: Runtime> Clone for Window<R> {
889897
fn clone(&self) -> Self {
890898
Self {

0 commit comments

Comments
 (0)