diff --git a/app/app.go b/app/app.go index 3cf90e44..69b3042e 100644 --- a/app/app.go +++ b/app/app.go @@ -27,19 +27,18 @@ var extraArgs string // On Android ID is the package property of AndroidManifest.xml, // on iOS ID is the CFBundleIdentifier of the app Info.plist, // on Wayland it is the toplevel app_id, -// on X11 it is the X11 XClassHint +// on X11 it is the X11 XClassHint. // -// ID is set by the gogio tool or manually with the -X linker flag. For example, +// ID is set by the [gioui.org/cmd/gogio] tool or manually with the -X linker flag. For example, // // go build -ldflags="-X 'gioui.org/app.ID=org.gioui.example.Kitchen'" . // // Note that ID is treated as a constant, and that changing it at runtime -// is not supported. Default value of ID is filepath.Base(os.Args[0]). +// is not supported. The default value of ID is filepath.Base(os.Args[0]). var ID = "" // A FrameEvent requests a new frame in the form of a list of -// operations that describes what to display and how to handle -// input. +// operations that describes the window content. type FrameEvent struct { // Now is the current animation. Use Now instead of time.Now to // synchronize animation and to avoid the time.Now call overhead. @@ -53,7 +52,7 @@ type FrameEvent struct { // Frame completes the FrameEvent by drawing the graphical operations // from ops into the window. Frame func(frame *op.Ops) - // Source is the interface between the interface state and widgets. + // Source is the interface between the window and widgets. Source input.Source } @@ -65,13 +64,13 @@ type Insets struct { Top, Bottom, Left, Right unit.Dp } -// NewContext is a shorthand for +// NewContext is shorthand for // // layout.Context{ // Ops: ops, // Now: e.Now, -// Queue: e.Queue, -// Config: e.Config, +// Source: e.Source, +// Metric: e.Metric, // Constraints: layout.Exact(e.Size), // } // diff --git a/app/doc.go b/app/doc.go index dbbce080..8eabf500 100644 --- a/app/doc.go +++ b/app/doc.go @@ -8,12 +8,12 @@ See https://gioui.org for instructions to set up and run Gio programs. # Windows -Create a new Window by calling NewWindow. On mobile platforms or when Gio +Create a new [Window] by calling [NewWindow]. On mobile platforms or when Gio is embedded in another project, NewWindow merely connects with a previously created window. -A Window is run by calling NextEvent in a loop. The most important event is -FrameEvent that prompts an update of the window contents. +A Window is run by calling its NextEvent method in a loop. The most important event is +[FrameEvent] that prompts an update of the window contents. For example: @@ -30,7 +30,7 @@ For example: } A program must keep receiving events from the event channel until -DestroyEvent is received. +[DestroyEvent] is received. # Main @@ -55,12 +55,6 @@ For example, to display a blank but otherwise functional window: app.Main() } -# Event queue - -A FrameEvent's Queue method returns an event.Queue implementation that distributes -incoming events to the event handlers declared in the last frame. -See the gioui.org/io/event package for more information about event handlers. - # Permissions The packages under gioui.org/app/permission should be imported diff --git a/app/window.go b/app/window.go index 8a03613a..19bf5504 100644 --- a/app/window.go +++ b/app/window.go @@ -335,7 +335,7 @@ func (w *Window) processFrame(d driver) { w.updateAnimation(d) } -// Invalidate the window such that a FrameEvent will be generated immediately. +// Invalidate the window such that a [FrameEvent] will be generated immediately. // If the window is inactive, the event is sent when the window becomes active. // // Note that Invalidate is intended for externally triggered updates, such as a @@ -374,12 +374,12 @@ func (w *Window) Option(opts ...Option) { // Run f in the same thread as the native window event loop, and wait for f to // return or the window to close. Run is guaranteed not to deadlock if it is -// invoked during the handling of a ViewEvent, FrameEvent, -// StageEvent; call Run in a separate goroutine to avoid deadlock in all +// invoked during the handling of a [ViewEvent], [FrameEvent], +// [StageEvent]; call Run in a separate goroutine to avoid deadlock in all // other cases. // // Note that most programs should not call Run; configuring a Window with -// CustomRenderer is a notable exception. +// [CustomRenderer] is a notable exception. func (w *Window) Run(f func()) { done := make(chan struct{}) w.driverDefer(func(d driver) { @@ -724,7 +724,7 @@ func (w *Window) destroyGPU() { } } -// waitFrame waits for the client to either call FrameEvent.Frame +// waitFrame waits for the client to either call [FrameEvent.Frame] // or to continue event handling. func (w *Window) waitFrame(d driver) *op.Ops { for {