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

@ -23,7 +23,7 @@ use crate::platform::web::{CustomCursorFuture, PollStrategy, WaitUntilStrategy};
use crate::platform_impl::platform::cursor::CustomCursor;
use crate::platform_impl::web::event_loop::proxy::EventLoopProxy;
use crate::platform_impl::Window;
use crate::window::{CustomCursor as RootCustomCursor, CustomCursorSource, Theme, WindowId};
use crate::window::{CustomCursor as CoreCustomCursor, CustomCursorSource, Theme, WindowId};
#[derive(Default, Debug)]
struct ModifiersShared(Rc<Cell<ModifiersState>>);
@ -65,7 +65,7 @@ impl ActiveEventLoop {
}
pub fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture {
CustomCursorFuture(CustomCursor::new_async(self, source.inner))
CustomCursorFuture(CustomCursor::new_async(self, source))
}
pub fn register(&self, canvas: &Rc<backend::Canvas>, window_id: WindowId) {
@ -498,8 +498,8 @@ impl RootActiveEventLoop for ActiveEventLoop {
fn create_custom_cursor(
&self,
source: CustomCursorSource,
) -> Result<RootCustomCursor, RequestError> {
Ok(RootCustomCursor { inner: CustomCursor::new(self, source.inner) })
) -> Result<CoreCustomCursor, RequestError> {
Ok(CoreCustomCursor(Arc::new(CustomCursor::new(self, source))))
}
fn available_monitors(&self) -> Box<dyn Iterator<Item = CoremMonitorHandle>> {