MacOS: cache custom cursors (#3291)

This commit is contained in:
daxpedda 2023-12-23 16:34:32 +01:00 committed by GitHub
parent e5310ade08
commit a8f49dc8ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View 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))
}
}