mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 23:23:14 -04:00
MacOS: cache custom cursors (#3291)
This commit is contained in:
17
src/platform_impl/macos/cursor.rs
Normal file
17
src/platform_impl/macos/cursor.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use objc2::rc::Id;
|
||||
|
||||
use super::appkit::NSCursor;
|
||||
use super::EventLoopWindowTarget;
|
||||
use crate::cursor::OnlyCursorImageBuilder;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct CustomCursor(pub(crate) Id<NSCursor>);
|
||||
|
||||
impl CustomCursor {
|
||||
pub(crate) fn build<T>(
|
||||
cursor: OnlyCursorImageBuilder,
|
||||
_: &EventLoopWindowTarget<T>,
|
||||
) -> CustomCursor {
|
||||
Self(NSCursor::from_image(&cursor.0))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user