Changed the presenter to only send 'set_cursor_style' on the topmost window

co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Mikayla Maki 2023-01-25 08:58:41 -08:00
parent 27a80a1c94
commit 45e4e3354e
7 changed files with 54 additions and 65 deletions

View file

@ -37,7 +37,6 @@ use objc::{
runtime::{Class, Object, Sel},
sel, sel_impl,
};
use pathfinder_geometry::vector::Vector2F;
use postage::oneshot;
use ptr::null_mut;
use std::{
@ -696,21 +695,18 @@ impl platform::Platform for MacPlatform {
Ok(())
}
fn set_cursor_style(&self, style: CursorStyle, window_id: usize, screen_position: &Vector2F) {
if Some(window_id) == Window::window_id_under(screen_position) {
dbg!(screen_position, style);
unsafe {
let cursor: id = match style {
CursorStyle::Arrow => msg_send![class!(NSCursor), arrowCursor],
CursorStyle::ResizeLeftRight => {
msg_send![class!(NSCursor), resizeLeftRightCursor]
}
CursorStyle::ResizeUpDown => msg_send![class!(NSCursor), resizeUpDownCursor],
CursorStyle::PointingHand => msg_send![class!(NSCursor), pointingHandCursor],
CursorStyle::IBeam => msg_send![class!(NSCursor), IBeamCursor],
};
let _: () = msg_send![cursor, set];
}
fn set_cursor_style(&self, style: CursorStyle) {
unsafe {
let cursor: id = match style {
CursorStyle::Arrow => msg_send![class!(NSCursor), arrowCursor],
CursorStyle::ResizeLeftRight => {
msg_send![class!(NSCursor), resizeLeftRightCursor]
}
CursorStyle::ResizeUpDown => msg_send![class!(NSCursor), resizeUpDownCursor],
CursorStyle::PointingHand => msg_send![class!(NSCursor), pointingHandCursor],
CursorStyle::IBeam => msg_send![class!(NSCursor), IBeamCursor],
};
let _: () = msg_send![cursor, set];
}
}