cursor: refactor CustomCursor to be dyn

cursor: refactor `CustomCursor` to be `dyn`

Same as for `MonitorHandle`, the source was changed to support
all kinds of sources.
This commit is contained in:
Kirill Chibisov 2025-03-13 17:18:37 +03:00 committed by GitHub
parent a0464ae83b
commit ae28eea406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 329 additions and 333 deletions

View file

@ -15,7 +15,7 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
};
use super::util;
use crate::cursor::CursorImage;
use crate::cursor::{CursorImage, CustomCursorProvider};
use crate::dpi::PhysicalSize;
use crate::error::RequestError;
use crate::icon::*;
@ -196,6 +196,12 @@ impl Default for SelectedCursor {
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub struct WinCursor(pub(super) Arc<RaiiCursor>);
impl CustomCursorProvider for WinCursor {
fn is_animated(&self) -> bool {
false
}
}
impl WinCursor {
pub(crate) fn new(image: &CursorImage) -> Result<Self, RequestError> {
let mut bgra = image.rgba.clone();