Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix popup kind window support on Windows (#14063)
Jason Lee1887a6db53da
diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rsindex 28e992a8e4c..cdc8949b599 100644--- a/crates/gpui/src/platform/windows/events.rs+++ b/crates/gpui/src/platform/windows/events.rs@@ -801,7 +801,10 @@ fn handle_hit_test_msg(lparam: LPARAM,state_ptr: Rc<WindowsWindowStatePtr>,) -> Option<isize> {- if !state_ptr.hide_title_bar {+ if !state_ptr.is_movable {+ return None;+ }+ if state_ptr.hide_title_bar {return None;}diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rsindex 1cb469bd0eb..43de6ced62f 100644--- a/crates/gpui/src/platform/windows/window.rs+++ b/crates/gpui/src/platform/windows/window.rs@@ -57,6 +57,7 @@ pub(crate) struct WindowsWindowStatePtr {pub(crate) state: RefCell<WindowsWindowState>,pub(crate) handle: AnyWindowHandle,pub(crate) hide_title_bar: bool,+ pub(crate) is_movable: bool,pub(crate) executor: ForegroundExecutor,}@@ -212,6 +213,7 @@ impl WindowsWindowStatePtr {hwnd,handle: context.handle,hide_title_bar: context.hide_title_bar,+ is_movable: context.is_movable,executor: context.executor.clone(),})}@@ -235,6 +237,7 @@ struct WindowCreateContext {hide_title_bar: bool,display: WindowsDisplay,transparent: bool,+ is_movable: bool,executor: ForegroundExecutor,current_cursor: HCURSOR,}@@ -261,7 +264,14 @@ impl WindowsWindow {.map(|title| title.as_ref()).unwrap_or(""),);- let dwstyle = WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;+ let (dwexstyle, dwstyle) = if params.kind == WindowKind::PopUp {+ (WS_EX_TOOLWINDOW, WINDOW_STYLE(0x0))+ } else {+ (+ WS_EX_OVERLAPPEDWINDOW,+ WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,+ )+ };let hinstance = get_module_handle();let display = if let Some(display_id) = params.display_id {// if we obtain a display_id, then this ID must be valid.@@ -275,13 +285,14 @@ impl WindowsWindow {hide_title_bar,display,transparent: true,+ is_movable: params.is_movable,executor,current_cursor,};let lpparam = Some(&context as *const _ as *const _);let raw_hwnd = unsafe {CreateWindowExW(- WS_EX_APPWINDOW,+ dwexstyle,classname,&windowname,dwstyle,