Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Add `display_handle` implementation for Windows, update it for macOS (#52867)

Bowen Xu5375ca0ae27b
diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rs
index ace36d69540..8811a4159a0 100644
--- a/crates/gpui_macos/src/window.rs
+++ b/crates/gpui_macos/src/window.rs
@@ -1701,12 +1701,7 @@ impl rwh::HasWindowHandle for MacWindow {
impl rwh::HasDisplayHandle for MacWindow {
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
- // SAFETY: This is a no-op on macOS
- unsafe {
- Ok(rwh::DisplayHandle::borrow_raw(
- rwh::AppKitDisplayHandle::new().into(),
- ))
- }
+ Ok(rwh::DisplayHandle::appkit())
}
}
diff --git a/crates/gpui_windows/src/window.rs b/crates/gpui_windows/src/window.rs
index 92255f93fd9..f655c1989e2 100644
--- a/crates/gpui_windows/src/window.rs
+++ b/crates/gpui_windows/src/window.rs
@@ -540,10 +540,9 @@ impl rwh::HasWindowHandle for WindowsWindow {
}
}
-// todo(windows)
impl rwh::HasDisplayHandle for WindowsWindow {
fn display_handle(&self) -> std::result::Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
- unimplemented!()
+ Ok(rwh::DisplayHandle::windows())
}
}