From 30cb1e0b13b4c944ff2987a9aa49aa0704e15239 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Wed, 23 Oct 2024 16:37:45 +0200 Subject: [PATCH] Tweak get_cursor code (#713) Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- masonry/src/contexts.rs | 2 +- masonry/src/widget/widget.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/masonry/src/contexts.rs b/masonry/src/contexts.rs index 8886304e3..d95077ee7 100644 --- a/masonry/src/contexts.rs +++ b/masonry/src/contexts.rs @@ -368,7 +368,7 @@ impl_context_method!( // --- MARK: CURSOR --- // Cursor-related impls. -impl_context_method!(EventCtx<'_>, { +impl_context_method!(MutateCtx<'_>, EventCtx<'_>, UpdateCtx<'_>, { /// Notifies Masonry that the cursor returned by [`Widget::get_cursor`] has changed. /// /// This is mostly meant for cases where the cursor changes even if the pointer doesn't diff --git a/masonry/src/widget/widget.rs b/masonry/src/widget/widget.rs index b2793af56..efb927705 100644 --- a/masonry/src/widget/widget.rs +++ b/masonry/src/widget/widget.rs @@ -224,6 +224,8 @@ pub trait Widget: AsAny { /// Return the cursor icon for this widget. /// + /// This will be called when the mouse moves or [`cursor_icon_changed`](MutateCtx::cursor_icon_changed) is called. + /// /// **pos** - the mouse position in global coordinates (e.g. `(0,0)` is the top-left corner of the /// window). fn get_cursor(&self, ctx: &QueryCtx, pos: Point) -> CursorIcon {