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.
This commit is contained in:
wm4 2015-10-11 16:13:28 +02:00
parent d714c8380a
commit 94b6a1054e
1 changed files with 4 additions and 5 deletions

View File

@ -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;
}