loop

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package loop owns the state shared by every window: one lock that serializes rendering and callbacks, a queue of updates from other goroutines, and the windows to redraw. UI infrastructure uses it; theme only requests redraws.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drain

func Drain()

Drain runs queued functions. Call it with Lock held.

func InvalidateAll

func InvalidateAll()

InvalidateAll requests a redraw of every window. It never blocks on them.

func Lock

func Lock()

Lock is held while a window lays out a frame, and so during every UI callback.

func Pending added in v0.2.4

func Pending() bool

Pending reports whether updates are queued. It does not take the frame lock.

func Post

func Post(fn func())

Post queues fn, wakes every window and signals the optional resident worker.

func PostIf added in v0.2.5

func PostIf(fn func() bool)

PostIf runs a background check under the frame lock. In resident mode it redraws only when fn reports a visible change. Without resident mode, a frame is still needed to run the check, just like Post.

func Register

func Register(key any, invalidate func())

Register adds a window; invalidate requests a redraw of it.

func SetBackgroundUpdates added in v0.2.3

func SetBackgroundUpdates(enabled bool)

SetBackgroundUpdates lets updates run without a frame, under the same lock. Only resident applications enable it. The worker sleeps until an explicit post.

func SetIdleMemoryReclaim added in v0.1.6

func SetIdleMemoryReclaim(enabled bool)

func Unlock

func Unlock()

func Unregister

func Unregister(key any) int

Unregister removes a window and reports how many remain.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL