mirror of https://github.com/mpv-player/mpv
mac, cocoa: fix UI updates on none main queue threads
injecting the Apple Main Thread Checker via DYLD_INSERT_LIBRARIES=libMainThreadChecker.dylib identified several problems that needed fixing.
This commit is contained in:
parent
8e1ceaba34
commit
327b092bfc
|
@ -99,8 +99,10 @@ static Application *mpv_shared_app(void)
|
||||||
|
|
||||||
static void terminate_cocoa_application(void)
|
static void terminate_cocoa_application(void)
|
||||||
{
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[NSApp hide:NSApp];
|
[NSApp hide:NSApp];
|
||||||
[NSApp terminate:NSApp];
|
[NSApp terminate:NSApp];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation Application
|
@implementation Application
|
||||||
|
@ -300,8 +302,10 @@ static void init_cocoa_application(bool regular)
|
||||||
// Because activation policy has just been set to behave like a real
|
// Because activation policy has just been set to behave like a real
|
||||||
// application, that policy must be reset on exit to prevent, among
|
// application, that policy must be reset on exit to prevent, among
|
||||||
// other things, the menubar created here from remaining on screen.
|
// other things, the menubar created here from remaining on screen.
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bundle_started_from_finder(char **argv)
|
static bool bundle_started_from_finder(char **argv)
|
||||||
|
|
|
@ -395,8 +395,10 @@ void vo_cocoa_init(struct vo *vo)
|
||||||
cocoa_add_event_monitor(vo);
|
cocoa_add_event_monitor(vo);
|
||||||
|
|
||||||
if (!s->embedded) {
|
if (!s->embedded) {
|
||||||
|
run_on_main_thread(vo, ^{
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
set_application_icon(NSApp);
|
set_application_icon(NSApp);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue