perf: do not redraw on mouse move events

This commit is contained in:
Hojjat 2026-08-04 11:49:05 -06:00 • committed by Ashley Wulber
parent 86b236f2e1
commit b87e660eed

View file

@ -1391,7 +1391,6 @@ async fn run_instance<P>(
true true
} }
}); });
let no_window_events = window_events.is_empty();
#[cfg(wayland_platform)] #[cfg(wayland_platform)]
window_events.push(core::Event::PlatformSpecific( window_events.push(core::Event::PlatformSpecific(
core::event::PlatformSpecific::Wayland( core::event::PlatformSpecific::Wayland(
@ -1409,8 +1408,7 @@ async fn run_instance<P>(
&mut clipboard, &mut clipboard,
&mut messages, &mut messages,
); );
let mut needs_redraw = let mut needs_redraw = !messages.is_empty();
!no_window_events || !messages.is_empty();
if let Some(requested_size) = if let Some(requested_size) =
clipboard.requested_logical_size.lock().unwrap().take() clipboard.requested_logical_size.lock().unwrap().take()
{ {
@ -1466,8 +1464,17 @@ async fn run_instance<P>(
mouse_interaction, mouse_interaction,
.. ..
} => { } => {
let mouse_changed =
window.mouse_interaction != mouse_interaction;
window.update_mouse(mouse_interaction); window.update_mouse(mouse_interaction);
if mouse_changed {
window.request_redraw(
core::window::RedrawRequest::NextFrame,
);
}
#[cfg(not(feature = "unconditional-rendering"))] #[cfg(not(feature = "unconditional-rendering"))]
window.request_redraw(_redraw_request); window.request_redraw(_redraw_request);
} }