mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 08:25:34 +00:00
bdd6b32711
A program might choose to process events that affect UI state already laid out. For example, a button click might switch to a completely different UI page, but the click might be processed during the drawing of the current page. Avoiding that require either processing events very early during layout or adding InvalidateOps whenever events are handled late. Early event processing is awkward and InvalidateOps are easy to forget and their absence masked by any other cause of redraw. This change adds an implicit InvalidateOp for each frame where events have been delivered to the program, allowing late event handling without use of InvalidateOps. In the worst case we waste a frame, increasing power use. I hope that future optimizations will detect and discard the duplicate frame before it reaches the GPU. A similar situation applies to the delayed delivery of Editor events, but since Editor.Layout flushes remaining events, extra InvalidateOps are not required. Add a comment. Signed-off-by: Elias Naur <mail@eliasnaur.com>