Use platform API to request mouse position

Co-Authored-By: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
Nathan Sobo 2023-08-23 12:57:33 -06:00
parent 5996b6b46b
commit 684db11afd
8 changed files with 35 additions and 24 deletions

View file

@ -18,7 +18,7 @@ use cocoa::{
},
base::{id, nil, selector, BOOL, YES},
foundation::{
NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSPoint, NSProcessInfo, NSString,
NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSProcessInfo, NSString,
NSUInteger, NSURL,
},
};
@ -37,7 +37,7 @@ use objc::{
runtime::{Class, Object, Sel},
sel, sel_impl,
};
use pathfinder_geometry::vector::{vec2f, Vector2F};
use postage::oneshot;
use ptr::null_mut;
use std::{
@ -785,11 +785,6 @@ impl platform::Platform for MacPlatform {
Ok(())
}
fn mouse_position(&self) -> Vector2F {
let position: NSPoint = unsafe { msg_send![class!(NSEvent), mouseLocation] };
vec2f(position.x as f32, position.y as f32)
}
fn set_cursor_style(&self, style: CursorStyle) {
unsafe {
let new_cursor: id = match style {