mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
Create custom cursor with directly with event loop
Replace the `CustomCursorBuilder` with the `CustomCursorSource` and perform the loading of the cursor via the `EventLoop::create_custom_cursor` instead of passing it to the builder itself. This follows the `EventLoop::create_window` API.
This commit is contained in:
@@ -35,6 +35,8 @@ use super::{
|
||||
monitor::{self, MonitorHandle},
|
||||
observer::setup_control_flow_observers,
|
||||
};
|
||||
use crate::platform_impl::platform::cursor::CustomCursor;
|
||||
use crate::window::{CustomCursor as RootCustomCursor, CustomCursorSource};
|
||||
use crate::{
|
||||
error::EventLoopError,
|
||||
event::Event,
|
||||
@@ -77,6 +79,12 @@ pub struct ActiveEventLoop {
|
||||
}
|
||||
|
||||
impl ActiveEventLoop {
|
||||
pub fn create_custom_cursor(&self, source: CustomCursorSource) -> RootCustomCursor {
|
||||
RootCustomCursor {
|
||||
inner: CustomCursor::new(source.inner),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
||||
monitor::available_monitors()
|
||||
|
||||
Reference in New Issue
Block a user