feat(core): Implement HasDisplayHandle for Window (#9214)

This commit is contained in:
Fabian-Lars 2024-03-19 13:43:15 +01:00 committed by GitHub
parent 43230cb6b7
commit 75f5cb4015
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
tauri: 'patch:enhance'
---
`tauri::Window` and `tauri::WebviewWindow` now implement `raw_window_handle::HasDisplayHandle`.

View File

@ -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> {

View File

@ -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 {