diff --git a/crates/gpui/src/platform/mac/geometry.rs b/crates/gpui/src/platform/mac/geometry.rs index 0f3b1f6fce..9fce8846b7 100644 --- a/crates/gpui/src/platform/mac/geometry.rs +++ b/crates/gpui/src/platform/mac/geometry.rs @@ -19,7 +19,7 @@ pub trait Vector2FExt { impl Vector2FExt for Vector2F { fn to_screen_ns_point(&self, native_window: id) -> NSPoint { unsafe { - let point = NSPoint::new(self.x() as f64, -self.y() as f64); + let point = NSPoint::new(self.x() as f64, self.y() as f64); msg_send![native_window, convertPointToScreen: point] } } diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index bc934703be..46e115a436 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -483,6 +483,7 @@ impl Window { let native_view: id = msg_send![VIEW_CLASS, alloc]; let native_view = NSView::init(native_view); + assert!(!native_view.is_null()); let window = Self(Rc::new(RefCell::new(WindowState { @@ -828,12 +829,11 @@ impl platform::Window for Window { let self_id = self_borrow.id; unsafe { - let window_frame = self_borrow.frame(); let app = NSApplication::sharedApplication(nil); // Convert back to screen coordinates - let screen_point = - (position + window_frame.origin()).to_screen_ns_point(self_borrow.native_window); + let screen_point = position.to_screen_ns_point(self_borrow.native_window); + let window_number: NSInteger = msg_send![class!(NSWindow), windowNumberAtPoint:screen_point belowWindowWithWindowNumber:0]; let top_most_window: id = msg_send![app, windowWithWindowNumber: window_number];