Skip to content

Commit 74ccc9c

Browse files
committed
app: use empty frame when FrameEvent.Frame isn't called
Signed-off-by: Elias Naur <[email protected]>
1 parent 3f671af commit 74ccc9c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

app/window.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ type Window struct {
108108
}
109109

110110
type eventSummary struct {
111-
wakeup bool
112-
cfg *ConfigEvent
113-
view *ViewEvent
114-
frame *frameEvent
115-
destroy *DestroyEvent
111+
wakeup bool
112+
cfg *ConfigEvent
113+
view *ViewEvent
114+
frame *frameEvent
115+
framePending bool
116+
destroy *DestroyEvent
116117
}
117118

118119
type callbacks struct {
@@ -219,6 +220,7 @@ func (w *Window) frame(frame *op.Ops, viewport image.Point) error {
219220
}
220221

221222
func (w *Window) processFrame(frame *op.Ops, ack chan<- struct{}) {
223+
w.coalesced.framePending = false
222224
wrapper := &w.decorations.Ops
223225
off := op.Offset(w.lastFrame.off).Push(wrapper)
224226
ops.AddCall(&wrapper.Internal, &frame.Internal, ops.PC{}, ops.PCFor(&frame.Internal))
@@ -563,6 +565,10 @@ func (w *Window) nextEvent() (event.Event, bool) {
563565
s.wakeup = false
564566
}()
565567
switch {
568+
case s.framePending:
569+
// If the user didn't call FrameEvent.Event, process
570+
// an empty frame.
571+
w.processFrame(new(op.Ops), nil)
566572
case s.view != nil:
567573
e := *s.view
568574
s.view = nil
@@ -579,6 +585,7 @@ func (w *Window) nextEvent() (event.Event, bool) {
579585
case s.frame != nil:
580586
e := *s.frame
581587
s.frame = nil
588+
s.framePending = true
582589
return e.FrameEvent, true
583590
case s.wakeup:
584591
return wakeupEvent{}, true

0 commit comments

Comments
 (0)