From a4405ba60d721df454a4b536f29bcfa6d873a2dd Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 12 Aug 2019 21:22:30 -0700 Subject: [PATCH] macos: plumb changing the cursor --- window/src/os/macos/window.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index aa5ac6e3d..d88cb3622 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -131,7 +131,21 @@ impl WindowOpsMut for WindowInner { } fn hide(&mut self) {} - fn set_cursor(&mut self, cursor: Option) {} + + fn set_cursor(&mut self, cursor: Option) { + unsafe { + let ns_cursor_cls = class!(NSCursor); + if let Some(cursor) = cursor { + let instance: id = match cursor { + MouseCursor::Arrow => msg_send![ns_cursor_cls, arrowCursor], + MouseCursor::Text => msg_send![ns_cursor_cls, IBeamCursor], + MouseCursor::Hand => msg_send![ns_cursor_cls, pointingHandCursor], + }; + let () = msg_send![instance, set]; + } + } + } + fn invalidate(&mut self) { unsafe { let () = msg_send![*self.view, setNeedsDisplay: YES];