From 94b6a1054e6cd72b016d8a23fca56d76eaca629b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 11 Oct 2015 16:13:28 +0200 Subject: cocoa: set application policy before creating window This fixes a regression since commit f4d62da8. The original code run vo_cocoa_config_window() once without creating the window, which had the effect that the last part of the function was run at least once before the actual window was created. Fix the regression by moving it to before the window is created. The regression itself is hard to describe. One test case: start mpv from a fullscreened terminal window. It should switch to another desktop, with the mpv window visible. This didn't happen anymore. --- video/out/cocoa_common.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index d4f70c9f90..022520665a 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -265,6 +265,10 @@ void vo_cocoa_init(struct vo *vo) pthread_cond_init(&s->wakeup, NULL); vo->cocoa = s; cocoa_init_light_sensor(vo); + if (!s->embedded) { + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + set_application_icon(NSApp); + } } static int vo_cocoa_set_cursor_visibility(struct vo *vo, bool *visible) @@ -592,11 +596,6 @@ int vo_cocoa_config_window(struct vo *vo) vo->dheight = s->vo_dheight = frame.size.height; [s->nsgl_ctx update]; - - if (!s->embedded) { - [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - set_application_icon(NSApp); - } }); return 0; } -- cgit v1.2.3