mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 07:57:29 +00:00
app: [macOS] pace display link
On macOS the display link that drives redraws runs on a separate thread, and must switch to the main thread to invalidate its view. This change makes sure the display link can never call invalidate faster than we can draw. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-3
@@ -558,10 +558,14 @@ func newOSWindow() (*window, error) {
|
||||
view: view,
|
||||
scale: scale,
|
||||
}
|
||||
done := make(chan struct{})
|
||||
setNeedsDisplay := func() {
|
||||
C.setNeedsDisplay(w.view)
|
||||
done <- struct{}{}
|
||||
}
|
||||
dl, err := NewDisplayLink(func() {
|
||||
w.runOnMain(func() {
|
||||
C.setNeedsDisplay(w.view)
|
||||
})
|
||||
w.runOnMain(setNeedsDisplay)
|
||||
<-done
|
||||
})
|
||||
w.displayLink = dl
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user