Skip to main content

request_draw_without_invalidation

Function request_draw_without_invalidation 

Source
pub fn request_draw_without_invalidation()
Expand description

Request a frame without advancing invalidation_epoch.

dispatch_event won’t mark retained ancestors dirty for this call, so any widget that drew its previous frame into a backbuffer cache will composite the cached bitmap unchanged. Use this only when:

  • The change lives in an app-level overlay that paints fresh every frame outside any retained subtree (inspector hover rectangle, popup menus rendered via paint_global_overlay, scroll-fade decorations).
  • The change is position-only — a window drag-move, where the cached content is reused at a translated origin (see Window::on_event for the canonical example).

Do NOT call this from a widget that mutated its own state and expects the next paint to reflect it. That’s request_draw’s job. Hover indices, focus changes, animation ticks, button-press states — anything where the content of a retained widget differs from the cached bitmap — must call request_draw so the cache invalidates. The MenuBar hover regression in widgets/menu/widget/tests_2.rs exists precisely because this distinction was missed once already.