From d47c921b2984f8c1874bc3e2194c192b79f19b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 8 Oct 2025 03:46:32 +0200 Subject: [PATCH] Avoid redraw spam when `tooltip` follows cursor --- widget/src/tooltip.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/widget/src/tooltip.rs b/widget/src/tooltip.rs index 866f58d0..433844cb 100644 --- a/widget/src/tooltip.rs +++ b/widget/src/tooltip.rs @@ -203,6 +203,7 @@ where ) { if let Event::Mouse(_) = event { let state = tree.state.downcast_mut::(); + let previous_state = *state; let was_idle = *state == State::Idle; *state = cursor @@ -215,7 +216,9 @@ where if was_idle != is_idle { shell.invalidate_layout(); shell.request_redraw(); - } else if self.position == Position::FollowCursor { + } else if self.position == Position::FollowCursor + && *state != previous_state + { shell.request_redraw(); } }