app/internal/window: [macOS] move main thread dispatching to Go

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-17 14:15:30 +02:00
parent 65d79f295f
commit 85a75ee265
2 changed files with 7 additions and 4 deletions
+1 -3
View File
@@ -148,9 +148,7 @@ void gio_updateDisplayLink(CFTypeRef viewRef, CGDirectDisplayID dispID) {
void gio_setAnimating(CFTypeRef viewRef, BOOL anim) { void gio_setAnimating(CFTypeRef viewRef, BOOL anim) {
GioView *view = (__bridge GioView *)viewRef; GioView *view = (__bridge GioView *)viewRef;
dispatch_async(dispatch_get_main_queue(), ^{ [view setAnimating:anim];
[view setAnimating:anim];
});
} }
CFTypeRef gio_contextForView(CFTypeRef viewRef) { CFTypeRef gio_contextForView(CFTypeRef viewRef) {
+6 -1
View File
@@ -86,7 +86,12 @@ func (w *window) SetAnimating(anim bool) {
if anim { if anim {
animb = 1 animb = 1
} }
C.gio_setAnimating(w.view, animb) v := w.view
C.CFRetain(v)
runOnMain(func() {
defer C.CFRelease(v)
C.gio_setAnimating(v, animb)
})
} }
func (w *window) setStage(stage system.Stage) { func (w *window) setStage(stage system.Stage) {