diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-01-06 14:17:14 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-01-06 14:19:04 +0100 |
commit | 48e3344f84ad8c5da6957922f46c900783fd066c (patch) | |
tree | 506d710530cfa55766c2e453fffd7d3932eeb254 /video/out/cocoa_common.m | |
parent | 1fdc7e6c377d14569fdd4ac24352b351e36da803 (diff) | |
download | mpv-48e3344f84ad8c5da6957922f46c900783fd066c.tar.bz2 mpv-48e3344f84ad8c5da6957922f46c900783fd066c.tar.xz |
cocoa: don't reset window size when the video size doesn't change
Fixes #459
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 15305aa93f..98872cdcc7 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -72,6 +72,9 @@ struct vo_cocoa_state { void (*resize_redraw)(struct vo *vo, int w, int h); struct mp_log *log; + + uint32_t old_dwidth; + uint32_t old_dheight; }; 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); } -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) { 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); } -int vo_cocoa_config_window(struct vo *vo, uint32_t d_width, - uint32_t d_height, uint32_t flags, - int gl3profile) +int vo_cocoa_config_window(struct vo *vo, uint32_t width, uint32_t height, + uint32_t flags, int gl3profile) { struct vo_cocoa_state *s = vo->cocoa; __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->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) { // This is certainly the first execution of vo_config_window and // 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) - create_window(vo, d_width, d_height, flags); + create_window(vo, width, height, flags); } if (s->window) { // 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->enable_resize_redraw = true; }); |