From fa904150bfb7467b66e7fc0a7c709e61cb3dd9fc Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 18 Oct 2014 18:30:22 +0200 Subject: cocoa: reintroduce async resize After removing synchronous libdispatch calls, this looks like it doesn't deadlock anymore. I also experimented with pthread_mutex_trylock liek wm4 suggested, but it leads to some annoying black flickering. I will fallback to that only if some new deadlocks are discovered. --- video/out/cocoa/mpvadapter.h | 3 +-- video/out/cocoa/video_view.m | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'video/out/cocoa') diff --git a/video/out/cocoa/mpvadapter.h b/video/out/cocoa/mpvadapter.h index 30e2d572d8..8829abd096 100644 --- a/video/out/cocoa/mpvadapter.h +++ b/video/out/cocoa/mpvadapter.h @@ -19,8 +19,6 @@ #include "video/out/vo.h" @interface MpvCocoaAdapter : NSObject -- (void)lock; -- (void)unlock; - (void)setNeedsResize; - (void)signalMouseMovement:(NSPoint)point; - (void)putKeyEvent:(NSEvent*)event; @@ -29,6 +27,7 @@ - (void)putCommand:(char*)cmd; - (void)handleFilesArray:(NSArray *)files; - (void)didChangeWindowedScreenProfile:(NSScreen *)screen; +- (void)performAsyncResize:(NSSize)size; - (BOOL)isInFullScreenMode; - (BOOL)keyboardEnabled; diff --git a/video/out/cocoa/video_view.m b/video/out/cocoa/video_view.m index 07db876534..786c6ef4da 100644 --- a/video/out/cocoa/video_view.m +++ b/video/out/cocoa/video_view.m @@ -40,4 +40,10 @@ { return [self convertRectToBacking:[self frame]]; } + + +- (void)drawRect:(NSRect)rect +{ + [self.adapter performAsyncResize:[self frameInPixels].size]; +} @end -- cgit v1.2.3