1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

macos: plumb changing the cursor

This commit is contained in:
Wez Furlong 2019-08-12 21:22:30 -07:00
parent 5f547b6972
commit a4405ba60d

View File

@ -131,7 +131,21 @@ impl WindowOpsMut for WindowInner {
}
fn hide(&mut self) {}
fn set_cursor(&mut self, cursor: Option<MouseCursor>) {}
fn set_cursor(&mut self, cursor: Option<MouseCursor>) {
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];