Web: improve custom cursor loading (#3321)
This commit is contained in:
parent
e0fea25b06
commit
25d6a1d46d
4 changed files with 248 additions and 191 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use super::super::cursor::CustomCursorHandle;
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::super::DeviceId;
|
||||
use super::{backend, state::State};
|
||||
|
|
@ -139,6 +140,16 @@ impl Runner {
|
|||
)
|
||||
}
|
||||
}
|
||||
EventWrapper::CursorReady(result) => {
|
||||
for (_, canvas, _) in runner.0.all_canvases.borrow().deref() {
|
||||
if let Some(canvas) = canvas.upgrade() {
|
||||
canvas
|
||||
.borrow_mut()
|
||||
.cursor
|
||||
.handle_cursor_ready(result.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -811,6 +822,19 @@ impl Shared {
|
|||
pub(crate) fn waker(&self) -> Waker<Weak<Execution>> {
|
||||
self.0.proxy_spawner.waker()
|
||||
}
|
||||
|
||||
pub(crate) fn weak(&self) -> WeakShared {
|
||||
WeakShared(Rc::downgrade(&self.0))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct WeakShared(Weak<Execution>);
|
||||
|
||||
impl WeakShared {
|
||||
pub(crate) fn upgrade(&self) -> Option<Shared> {
|
||||
self.0.upgrade().map(Shared)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum EventWrapper {
|
||||
|
|
@ -820,6 +844,7 @@ pub(crate) enum EventWrapper {
|
|||
size: PhysicalSize<u32>,
|
||||
scale: f64,
|
||||
},
|
||||
CursorReady(Result<CustomCursorHandle, CustomCursorHandle>),
|
||||
}
|
||||
|
||||
impl From<Event<()>> for EventWrapper {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue