diff --git a/crates/gpui/src/platform/mac/geometry.rs b/crates/gpui/src/platform/mac/geometry.rs index 9fce8846b78240d1cdb83515def1c458c04968ef..6a479681181e41ff454d2e7d50e554a9c7328598 100644 --- a/crates/gpui/src/platform/mac/geometry.rs +++ b/crates/gpui/src/platform/mac/geometry.rs @@ -14,12 +14,12 @@ use pathfinder_geometry::{ pub trait Vector2FExt { /// Converts self to an NSPoint with y axis pointing up. - fn to_screen_ns_point(&self, native_window: id) -> NSPoint; + fn to_screen_ns_point(&self, native_window: id, window_height: f64) -> NSPoint; } impl Vector2FExt for Vector2F { - fn to_screen_ns_point(&self, native_window: id) -> NSPoint { + fn to_screen_ns_point(&self, native_window: id, window_height: f64) -> NSPoint { unsafe { - let point = NSPoint::new(self.x() as f64, self.y() as f64); + let point = NSPoint::new(self.x() as f64, window_height - 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 46e115a436bb0d1eccdf7bf86bd66d0e37073945..e67aa25e1369ebf787af446ff8610049e8427d59 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -832,7 +832,10 @@ impl platform::Window for Window { let app = NSApplication::sharedApplication(nil); // Convert back to screen coordinates - let screen_point = position.to_screen_ns_point(self_borrow.native_window); + let screen_point = position.to_screen_ns_point( + self_borrow.native_window, + self_borrow.content_size().y() as f64, + ); let window_number: NSInteger = msg_send![class!(NSWindow), windowNumberAtPoint:screen_point belowWindowWithWindowNumber:0]; let top_most_window: id = msg_send![app, windowWithWindowNumber: window_number];