summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-06-25 19:28:08 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-06-25 22:13:48 +0200
commit66693662800443fd3e28c57f665d50b232b46596 (patch)
tree7fd029d46ee47da6a6235aee543ff8474738ded4 /video
parent88916143a7428489b7d822fb2783230c0c2235c8 (diff)
downloadmpv-66693662800443fd3e28c57f665d50b232b46596.tar.bz2
mpv-66693662800443fd3e28c57f665d50b232b46596.tar.xz
cocoa_common: schedule a redraw frame after a non live resize
A redraw forces recalculation of panscan and other stuff not accounted for in the resize_redraw codepath. This is actually a hack but works really well in my tests. Thanks @wm4 and @Cpuroast for the idea. Fixes #86 [ci skip]
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m21
1 files changed, 18 insertions, 3 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 0e61b7ea71..93491dcf8d 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -82,6 +82,7 @@ struct vo_cocoa_state {
bool did_resize;
bool did_async_resize;
bool out_fs_resize;
+ bool want_redraw;
IOPMAssertionID power_mgmt_assertion;
@@ -98,6 +99,7 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
*s = (struct vo_cocoa_state){
.did_resize = NO,
.did_async_resize = NO,
+ .want_redraw = NO,
.current_video_size = {0,0},
.previous_video_size = {0,0},
.out_fs_resize = NO,
@@ -507,6 +509,11 @@ int vo_cocoa_check_events(struct vo *vo)
return VO_EVENT_RESIZE;
}
+ if (s->want_redraw) {
+ s->want_redraw = NO;
+ vo->want_redraw = true;
+ }
+
return 0;
}
@@ -902,10 +909,18 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
struct vo *vo = [self videoOutput];
if (vo && resize_callback_registered(vo)) {
- NSSize size = to_pixels(vo, [self bounds]).size;
- resize_redraw(vo, size.width, size.height);
+ if ([self inLiveResize]) {
+ NSSize size = to_pixels(vo, [self bounds]).size;
+ resize_redraw(vo, size.width, size.height);
+ } else {
+ // If not in live resize window was probably resized from
+ // fullscreen toggle or resize. Make sure we invoke a real repaint
+ // ASAP so that the displayed image is correct.
+ struct vo_cocoa_state *s = vo->cocoa;
+ s->want_redraw = YES;
+ }
} else {
- [[NSColor clearColor] set];
+ [[NSColor blackColor] set];
NSRectFill([self bounds]);
}
}