cocoa: don't reset window size when the video size doesn't change

Fixes #459
This commit is contained in:
Stefano Pigozzi 2014-01-06 14:17:14 +01:00
parent 1fdc7e6c37
commit 48e3344f84
1 changed files with 14 additions and 15 deletions

View File

@ -72,6 +72,9 @@ struct vo_cocoa_state {
void (*resize_redraw)(struct vo *vo, int w, int h); void (*resize_redraw)(struct vo *vo, int w, int h);
struct mp_log *log; struct mp_log *log;
uint32_t old_dwidth;
uint32_t old_dheight;
}; };
void *vo_cocoa_glgetaddr(const char *s) void *vo_cocoa_glgetaddr(const char *s)
@ -357,14 +360,6 @@ static void cocoa_set_window_title(struct vo *vo, const char *title)
talloc_free(talloc_ctx); talloc_free(talloc_ctx);
} }
static void update_window(struct vo *vo, int d_width, int d_height)
{
struct vo_cocoa_state *s = vo->cocoa;
[s->window queueNewVideoSize:NSMakeSize(d_width, d_height)];
cocoa_set_window_title(vo, vo_get_window_title(vo));
vo_cocoa_fullscreen(vo);
}
static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height) static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
{ {
struct vo_cocoa_state *s = vo->cocoa; struct vo_cocoa_state *s = vo->cocoa;
@ -387,9 +382,8 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
vo_cocoa_set_current_context(vo, false); vo_cocoa_set_current_context(vo, false);
} }
int vo_cocoa_config_window(struct vo *vo, uint32_t d_width, int vo_cocoa_config_window(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_height, uint32_t flags, uint32_t flags, int gl3profile)
int gl3profile)
{ {
struct vo_cocoa_state *s = vo->cocoa; struct vo_cocoa_state *s = vo->cocoa;
__block int ctxok = 0; __block int ctxok = 0;
@ -399,6 +393,10 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
s->enable_resize_redraw = false; s->enable_resize_redraw = false;
s->aspdat = vo->aspdat; s->aspdat = vo->aspdat;
bool reset_size = s->old_dwidth != width || s->old_dheight != height;
s->old_dwidth = width;
s->old_dheight = height;
if (flags & VOFLAG_HIDDEN) { if (flags & VOFLAG_HIDDEN) {
// This is certainly the first execution of vo_config_window and // This is certainly the first execution of vo_config_window and
// is called in order for an OpenGL based VO to perform detection // is called in order for an OpenGL based VO to perform detection
@ -418,16 +416,17 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
} }
if (!s->window) if (!s->window)
create_window(vo, d_width, d_height, flags); create_window(vo, width, height, flags);
} }
if (s->window) { if (s->window) {
// Everything is properly initialized // Everything is properly initialized
update_window(vo, d_width, d_height); if (reset_size)
[s->window queueNewVideoSize:NSMakeSize(width, height)];
cocoa_set_window_title(vo, vo_get_window_title(vo));
vo_cocoa_fullscreen(vo);
} }
});
dispatch_sync(dispatch_get_main_queue(), ^{
s->inside_sync_section = false; s->inside_sync_section = false;
s->enable_resize_redraw = true; s->enable_resize_redraw = true;
}); });