mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
app: use empty frame when FrameEvent.Frame isn't called
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+12
-5
@@ -108,11 +108,12 @@ type Window struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type eventSummary struct {
|
type eventSummary struct {
|
||||||
wakeup bool
|
wakeup bool
|
||||||
cfg *ConfigEvent
|
cfg *ConfigEvent
|
||||||
view *ViewEvent
|
view *ViewEvent
|
||||||
frame *frameEvent
|
frame *frameEvent
|
||||||
destroy *DestroyEvent
|
framePending bool
|
||||||
|
destroy *DestroyEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
type callbacks struct {
|
type callbacks struct {
|
||||||
@@ -219,6 +220,7 @@ func (w *Window) frame(frame *op.Ops, viewport image.Point) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) processFrame(frame *op.Ops, ack chan<- struct{}) {
|
func (w *Window) processFrame(frame *op.Ops, ack chan<- struct{}) {
|
||||||
|
w.coalesced.framePending = false
|
||||||
wrapper := &w.decorations.Ops
|
wrapper := &w.decorations.Ops
|
||||||
off := op.Offset(w.lastFrame.off).Push(wrapper)
|
off := op.Offset(w.lastFrame.off).Push(wrapper)
|
||||||
ops.AddCall(&wrapper.Internal, &frame.Internal, ops.PC{}, ops.PCFor(&frame.Internal))
|
ops.AddCall(&wrapper.Internal, &frame.Internal, ops.PC{}, ops.PCFor(&frame.Internal))
|
||||||
@@ -563,6 +565,10 @@ func (w *Window) nextEvent() (event.Event, bool) {
|
|||||||
s.wakeup = false
|
s.wakeup = false
|
||||||
}()
|
}()
|
||||||
switch {
|
switch {
|
||||||
|
case s.framePending:
|
||||||
|
// If the user didn't call FrameEvent.Event, process
|
||||||
|
// an empty frame.
|
||||||
|
w.processFrame(new(op.Ops), nil)
|
||||||
case s.view != nil:
|
case s.view != nil:
|
||||||
e := *s.view
|
e := *s.view
|
||||||
s.view = nil
|
s.view = nil
|
||||||
@@ -579,6 +585,7 @@ func (w *Window) nextEvent() (event.Event, bool) {
|
|||||||
case s.frame != nil:
|
case s.frame != nil:
|
||||||
e := *s.frame
|
e := *s.frame
|
||||||
s.frame = nil
|
s.frame = nil
|
||||||
|
s.framePending = true
|
||||||
return e.FrameEvent, true
|
return e.FrameEvent, true
|
||||||
case s.wakeup:
|
case s.wakeup:
|
||||||
return wakeupEvent{}, true
|
return wakeupEvent{}, true
|
||||||
|
|||||||
Reference in New Issue
Block a user