From dd081c78b96dabbc451cf6634b064d1041cd9f18 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 21 Jul 2019 21:58:54 +0200 Subject: [PATCH] ui/app: make DrawEvent optional It is never a good idea not to draw in response to a DrawEvent, but let's not hang the program if it doesn't call Window.Draw. Signed-off-by: Elias Naur --- ui/app/window.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/app/window.go b/ui/app/window.go index 9851ea46..8edd199d 100644 --- a/ui/app/window.go +++ b/ui/app/window.go @@ -248,7 +248,13 @@ func (w *Window) run(opts *WindowOptions) { w.drawStart = time.Now() w.hasNextFrame = false w.out <- e - frame := <-w.frames + var frame *ui.Ops + // Wait for either a frame or the ack event, + // which meant that the client didn't draw. + select { + case frame = <-w.frames: + case w.out <- ackEvent: + } if w.gpu != nil { if e2.sync { w.gpu.Refresh()