[vlc-commits] gui/minimal_macosx: Fix WindowControl handling

Marvin Scholz git at videolan.org
Sun Nov 26 02:18:20 CET 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Sun Nov 26 02:04:45 2017 +0100| [093bbee6917d6b396e96a43cadf4411fa9a3e1a2] | committer: Marvin Scholz

gui/minimal_macosx: Fix WindowControl handling

This is still very buggy but does not crash anymore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=093bbee6917d6b396e96a43cadf4411fa9a3e1a2
---

 modules/gui/minimal_macosx/intf.m | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/modules/gui/minimal_macosx/intf.m b/modules/gui/minimal_macosx/intf.m
index 27ff54577b..311fd3c031 100644
--- a/modules/gui/minimal_macosx/intf.m
+++ b/modules/gui/minimal_macosx/intf.m
@@ -149,25 +149,28 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
         }
         case VOUT_WINDOW_SET_SIZE:
         {
+            unsigned int i_width  = va_arg(args, unsigned int);
+            unsigned int i_height = va_arg(args, unsigned int);
             @autoreleasepool {
-                NSRect theFrame = [o_window frame];
-                unsigned int i_width  = va_arg(args, unsigned int);
-                unsigned int i_height = va_arg(args, unsigned int);
-                theFrame.size.width = i_width;
-                theFrame.size.height = i_height;
-                [o_window setFrame: theFrame display: YES animate: YES];
+                dispatch_sync(dispatch_get_main_queue(), ^{
+                    NSRect theFrame = [o_window frame];
+                    theFrame.size.width = i_width;
+                    theFrame.size.height = i_height;
+                    [o_window setFrame:theFrame display: YES animate: YES];
+                });
             }
             return VLC_SUCCESS;
         }
         case VOUT_WINDOW_SET_FULLSCREEN:
         {
+            int i_full = va_arg(args, int);
             @autoreleasepool {
-                int i_full = va_arg(args, int);
-
-                if (i_full)
-                    [o_window performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
-                else
-                    [o_window performSelectorOnMainThread:@selector(leaveFullscreen) withObject:nil waitUntilDone:NO];
+                dispatch_sync(dispatch_get_main_queue(), ^{
+                    if (i_full)
+                        [(VLCMinimalVoutWindow*)o_window enterFullscreen];
+                    else
+                        [(VLCMinimalVoutWindow*)o_window leaveFullscreen];
+                });
             }
             return VLC_SUCCESS;
         }



More information about the vlc-commits mailing list