From 5375ca0ae27bf11713cf319358ac289db16cc749 Mon Sep 17 00:00:00 2001 From: Bowen Xu <40262910+bowenxuuu@users.noreply.github.com> Date: Sun, 5 Apr 2026 04:10:22 +0800 Subject: [PATCH] gpui: Add `display_handle` implementation for Windows, update it for macOS (#52867) Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/gpui_macos/src/window.rs | 7 +------ crates/gpui_windows/src/window.rs | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rs index ace36d695401ce76949129197dcd05135508f7d3..8811a4159a0f539d2bae2c62242a3d5f490686ef 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::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 92255f93fd95969931c6b1ae8cb465ff628f82cb..f655c1989e2c69743032703532f91b3b517084b6 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::HandleError> { - unimplemented!() + Ok(rwh::DisplayHandle::windows()) } }