diff --git a/crates/components/src/cursor_area.rs b/crates/components/src/cursor_area.rs index 33abeb77c..d6cbc0029 100644 --- a/crates/components/src/cursor_area.rs +++ b/crates/components/src/cursor_area.rs @@ -1,4 +1,5 @@ use dioxus::prelude::*; +use freya_common::EventMessage; use freya_elements::elements as dioxus_elements; use freya_hooks::use_platform; use winit::window::CursorIcon; @@ -46,7 +47,7 @@ pub fn CursorArea<'a>(cx: Scope<'a, CursorAreaProps<'a>>) -> Element<'a> { to_owned![platform]; move |_| { *is_hovering.write_silent() = true; - platform.set_cursor(icon); + platform.send(EventMessage::SetCursorIcon(icon)).unwrap(); } }; @@ -54,7 +55,9 @@ pub fn CursorArea<'a>(cx: Scope<'a, CursorAreaProps<'a>>) -> Element<'a> { to_owned![platform]; move |_| { *is_hovering.write_silent() = false; - platform.set_cursor(CursorIcon::default()); + platform + .send(EventMessage::SetCursorIcon(CursorIcon::default())) + .unwrap(); } }; @@ -62,7 +65,9 @@ pub fn CursorArea<'a>(cx: Scope<'a, CursorAreaProps<'a>>) -> Element<'a> { to_owned![is_hovering]; move || { if *is_hovering.read() { - platform.set_cursor(CursorIcon::default()); + platform + .send(EventMessage::SetCursorIcon(CursorIcon::default())) + .unwrap(); } } }); diff --git a/crates/hooks/src/use_platform.rs b/crates/hooks/src/use_platform.rs index 47a4e4874..40f78ec70 100644 --- a/crates/hooks/src/use_platform.rs +++ b/crates/hooks/src/use_platform.rs @@ -1,7 +1,7 @@ use dioxus_core::ScopeState; use freya_common::EventMessage; use tokio::sync::mpsc::UnboundedSender; -use winit::{event_loop::EventLoopProxy, window::CursorIcon}; +use winit::event_loop::EventLoopProxy; #[derive(Clone)] pub struct UsePlatform { @@ -28,10 +28,6 @@ impl UsePlatform { } Ok(()) } - - pub fn set_cursor(&self, cursor_icon: CursorIcon) { - self.send(EventMessage::SetCursorIcon(cursor_icon)).ok(); - } } pub fn use_platform(cx: &ScopeState) -> UsePlatform {