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_windows: Fix immovable windows skipping hit testing entirely (#59816)

Lukas Wirth9ac117693b20
diff --git a/crates/gpui_windows/src/events.rs b/crates/gpui_windows/src/events.rs
index f101d82f017..619765a2fd6 100644
--- a/crates/gpui_windows/src/events.rs
+++ b/crates/gpui_windows/src/events.rs
@@ -888,7 +888,7 @@ impl WindowsWindowInner {
}
fn handle_hit_test_msg(&self, handle: HWND, lparam: LPARAM) -> Option<isize> {
- if !self.is_movable || self.state.is_fullscreen() {
+ if self.state.is_fullscreen() {
return None;
}
@@ -899,16 +899,13 @@ impl WindowsWindowInner {
.callbacks
.hit_test_window_control
.set(Some(callback));
- if let Some(area) = area {
- match area {
- WindowControlArea::Drag => Some(HTCAPTION as _),
- WindowControlArea::Close => return Some(HTCLOSE as _),
- WindowControlArea::Max => return Some(HTMAXBUTTON as _),
- WindowControlArea::Min => return Some(HTMINBUTTON as _),
- }
- } else {
- None
- }
+ area.and_then(|area| match area {
+ WindowControlArea::Drag if self.is_movable => Some(HTCAPTION as _),
+ WindowControlArea::Drag => None,
+ WindowControlArea::Close => Some(HTCLOSE as _),
+ WindowControlArea::Max => Some(HTMAXBUTTON as _),
+ WindowControlArea::Min => Some(HTMINBUTTON as _),
+ })
} else {
None
};