Skip to content

Commit e5c8863

Browse files
committed
internal/graphicsdriver/metal: bug fix: an app was frozen by fullscreening
Closes #3354
1 parent 1853f90 commit e5c8863

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

internal/graphicsdriver/metal/displaylink_macos.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,19 @@ func ebitengine_DisplayLinkOutputCallback(displayLinkRef C.CVDisplayLinkRef, inN
173173

174174
func (v *view) nextDrawable() ca.MetalDrawable {
175175
if v.metalDisplayLink != 0 {
176+
const wait = 100 * time.Millisecond
176177
if v.drawableTimer == nil {
177-
v.drawableTimer = time.NewTimer(time.Second)
178+
v.drawableTimer = time.NewTimer(wait)
178179
} else {
179-
v.drawableTimer.Reset(time.Second)
180+
v.drawableTimer.Reset(wait)
180181
}
181182
defer v.drawableTimer.Stop()
182183
select {
183184
case d := <-v.drawableCh:
184185
return d
185186
case <-v.drawableTimer.C:
186-
// This happens when the main thread needs to execute the notification observer callback.
187+
// This happens when the main thread needs to execute the notification observer callback,
188+
// or when the appliation goes to full screen (#3354).
187189
return ca.MetalDrawable{}
188190
}
189191
}

0 commit comments

Comments
 (0)