mirror of
https://github.com/mpv-player/mpv
synced 2025-01-05 03:06:28 +01:00
cocoa_common: make windows appear again
Commit 9efe32120
stops recreating the hidden window used for OpenGL's
extensions autodetection. The `cocoa_common` code assumed the hidden flag could
only come when creating a window which is now not true anymore.
Move some code around so that hidden, fullscreen and window position are
respected on subsequent calls of config.
This commit is contained in:
parent
979ce46c64
commit
8fc0b618d5
@ -355,8 +355,6 @@ static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
|
||||
uint32_t flags, int gl3profile)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
struct MPOpts *opts = vo->opts;
|
||||
|
||||
const NSRect window_rect = NSMakeRect(xinerama_x, xinerama_y,
|
||||
d_width, d_height);
|
||||
const NSRect glview_rect = NSMakeRect(0, 0, 100, 100);
|
||||
@ -410,21 +408,6 @@ static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
|
||||
|
||||
[NSApp setDelegate:s->window];
|
||||
[s->window setDelegate:s->window];
|
||||
[s->window setContentSize:s->current_video_size];
|
||||
[s->window setContentAspectRatio:s->current_video_size];
|
||||
[s->window setFrameOrigin:NSMakePoint(vo->dx, vo->dy)];
|
||||
|
||||
if (flags & VOFLAG_HIDDEN) {
|
||||
[s->window orderOut:nil];
|
||||
} else {
|
||||
[s->window makeKeyAndOrderFront:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
if (flags & VOFLAG_FULLSCREEN)
|
||||
vo_cocoa_fullscreen(vo);
|
||||
|
||||
vo_set_level(vo, opts->vo_ontop);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -453,6 +436,13 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
|
||||
int gl3profile)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
struct MPOpts *opts = vo->opts;
|
||||
|
||||
if (vo->config_count > 0) {
|
||||
NSPoint origin = [s->window frame].origin;
|
||||
vo->dx = origin.x;
|
||||
vo->dy = origin.y;
|
||||
}
|
||||
|
||||
update_state_sizes(s, d_width, d_height);
|
||||
|
||||
@ -463,6 +453,22 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
|
||||
update_window(vo);
|
||||
}
|
||||
|
||||
if (flags & VOFLAG_HIDDEN) {
|
||||
[s->window orderOut:nil];
|
||||
} else {
|
||||
[s->window makeKeyAndOrderFront:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
if (flags & VOFLAG_FULLSCREEN)
|
||||
vo_cocoa_fullscreen(vo);
|
||||
|
||||
vo_set_level(vo, opts->vo_ontop);
|
||||
|
||||
[s->window setContentSize:s->current_video_size];
|
||||
[s->window setContentAspectRatio:s->current_video_size];
|
||||
[s->window setFrameOrigin:NSMakePoint(vo->dx, vo->dy)];
|
||||
|
||||
resize_window(vo);
|
||||
|
||||
if (s->window_title)
|
||||
|
Loading…
Reference in New Issue
Block a user