mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +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,
|
view: view,
|
||||||
scale: scale,
|
scale: scale,
|
||||||
}
|
}
|
||||||
dl, err := NewDisplayLink(func() {
|
done := make(chan struct{})
|
||||||
w.runOnMain(func() {
|
setNeedsDisplay := func() {
|
||||||
C.setNeedsDisplay(w.view)
|
C.setNeedsDisplay(w.view)
|
||||||
})
|
done <- struct{}{}
|
||||||
|
}
|
||||||
|
dl, err := NewDisplayLink(func() {
|
||||||
|
w.runOnMain(setNeedsDisplay)
|
||||||
|
<-done
|
||||||
})
|
})
|
||||||
w.displayLink = dl
|
w.displayLink = dl
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user