]> git.sesse.net Git - vlc/commitdiff
macosx: fixed subtitle rendering resolution when using the native fullscreen mode...
authorFelix Paul Kühne <fkuehne@videolan.org>
Tue, 25 Dec 2012 14:25:01 +0000 (15:25 +0100)
committerFelix Paul Kühne <fkuehne@videolan.org>
Tue, 25 Dec 2012 14:25:54 +0000 (15:25 +0100)
bug was triggered only when using controls provided by the OS like NSWindow's fullscreen button

modules/gui/macosx/VideoView.m
modules/gui/macosx/intf.m

index c454c499b6923fc368baf7a294f1ada66ef8784d..e7117976ff885c8fa7ac3120499bd148e4ce4010 100644 (file)
@@ -54,6 +54,8 @@
     if (p_vout)
         vlc_object_release(p_vout);
 
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+
     [self unregisterDraggedTypes];
     [super dealloc];
 }
     i_lastScrollWheelDirection = 0;
     f_cumulated_magnification = 0.0;
 
+#ifdef MAC_OS_X_VERSION_10_7
+    if (!OSX_SNOW_LEOPARD) {
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowWillEnterFullScreenNotification object: nil];
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowDidEnterFullScreenNotification object: nil];
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowWillExitFullScreenNotification object: nil];
+    }
+#endif
+
     return self;
 }
 
         i_yvlckey = KEY_MOUSEWHEELDOWN;
     else
         i_yvlckey = KEY_MOUSEWHEELUP;
-    
+
     if (f_deltaX < 0.0f)
         i_xvlckey = KEY_MOUSEWHEELRIGHT;
     else
 #pragma mark -
 #pragma mark Basic view behaviour and touch events handling
 
+- (void)osWillChangeFullScreenStatus:(NSNotification *)notification
+{
+    playlist_t *p_playlist = pl_Get(VLCIntf);
+    if ([notification.name isEqualToString:@"NSWindowWillEnterFullScreenNotification"] || [notification.name isEqualToString:@"NSWindowDidEnterFullScreenNotification"])
+        var_SetBool(p_playlist, "fullscreen", 1);
+    else
+        var_SetBool(p_playlist, "fullscreen", 0);
+
+    NSArray *subviews = [self subviews];
+    NSUInteger count = [subviews count];
+
+    for (NSUInteger x = 0; x < count; x++) {
+        if ([[subviews objectAtIndex:x] respondsToSelector:@selector(reshape)])
+            [[subviews objectAtIndex:x] reshape];
+    }
+}
+
 - (BOOL)mouseDownCanMoveWindow
 {
     return YES;
index 9727c95a9095eb3952b3e3d61356c352682b4843..fbfd1dd7b21f989298a329f12ac3a0c55930fae2 100644 (file)
@@ -200,7 +200,7 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
             unsigned int i_width  = va_arg(args, unsigned int);
             unsigned int i_height = va_arg(args, unsigned int);
 
-            NSSize newSize = NSMakeSize(i_width, i_height);            
+            NSSize newSize = NSMakeSize(i_width, i_height);
             SEL sel = @selector(setNativeVideoSize:forWindow:);
             NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[[VLCMain sharedInstance] voutController] methodSignatureForSelector:sel]];
             [inv setTarget:[[VLCMain sharedInstance] voutController]];
@@ -1237,9 +1237,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     playlist_t * p_playlist = pl_Get(p_intf);
     BOOL b_fullscreen = i_full;
 
-    if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen) {
+    if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen)
         var_SetBool(p_playlist, "fullscreen", b_fullscreen);
-    }
 
     if (b_nativeFullscreenMode) {
         // this is called twice in certain situations, so only toogle if we really need to