cursor: Extract get_render_cursor_named()

This commit is contained in:
Ivan Molodetskikh
2025-02-26 14:45:50 +03:00
parent 98b92d4db7
commit 4719cc6d59
+15 -12
View File
@@ -75,21 +75,24 @@ impl CursorManager {
RenderCursor::Surface { hotspot, surface }
}
CursorImageStatus::Named(icon) => self
.get_cursor_with_name(icon, scale)
.map(|cursor| RenderCursor::Named {
icon,
scale,
cursor,
})
.unwrap_or_else(|| RenderCursor::Named {
icon: Default::default(),
scale,
cursor: self.get_default_cursor(scale),
}),
CursorImageStatus::Named(icon) => self.get_render_cursor_named(icon, scale),
}
}
fn get_render_cursor_named(&self, icon: CursorIcon, scale: i32) -> RenderCursor {
self.get_cursor_with_name(icon, scale)
.map(|cursor| RenderCursor::Named {
icon,
scale,
cursor,
})
.unwrap_or_else(|| RenderCursor::Named {
icon: Default::default(),
scale,
cursor: self.get_default_cursor(scale),
})
}
pub fn is_current_cursor_animated(&self, scale: i32) -> bool {
match &self.current_cursor {
CursorImageStatus::Hidden => false,