mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 07:57:29 +00:00
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 <mail@eliasnaur.com>
This commit is contained in:
+7
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user