Fixed bug in setting cursor style

This commit is contained in:
Mikayla Maki 2023-02-07 14:35:25 -08:00
parent 926b59b15d
commit db2aaa4367
2 changed files with 4 additions and 4 deletions

View File

@ -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]
}
}

View File

@ -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];