app: rename UpdateEvent to FrameEvent and add Frame field

While "DrawEvent" was too specific (op.Ops contains non-draw events),
"Update" is too vague: it's a common word, and could be misunderstood
to mean update parts of a window, not replace it.

"FrameEvent" is more specific, and is the usual way to refer to immediate
mode drawing.

While we're here, unexport Window.Update and add a Frame function to
FrameEvent, to emphasize that updating the window frame is only
appropriate during the handling of a FrameEvent.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-10 12:15:04 +02:00
parent e49df512f6
commit a937a76534
9 changed files with 29 additions and 25 deletions
+3 -3
View File
@@ -13,7 +13,7 @@ is embedded in another project, NewWindow merely connects with a previously
created window.
A Window is run by receiving events from its Events channel. The most
important event is UpdateEvent that prompts an update of the window
important event is FrameEvent that prompts an update of the window
contents and state.
For example:
@@ -22,7 +22,7 @@ For example:
w := app.NewWindow()
for e := range w.Events() {
if e, ok := e.(app.UpdateEvent); ok {
if e, ok := e.(app.FrameEvent); ok {
ops.Reset()
// Add operations to ops.
...
@@ -60,7 +60,7 @@ For example, to display a blank but otherwise functional window:
Event queue
A Window's Queue method returns an event.Queue implementation that distributes
incoming events to the event handlers declared in the latest call to Update.
incoming events to the event handlers declared in the latest frame.
See the gioui.org/ui package for more information about event handlers.
*/