[vlc-commits] macosx: fixed subtitle rendering resolution when using the native fullscreen mode (close #7946)

Felix Paul Kühne git at videolan.org
Tue Dec 25 15:25:54 CET 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Dec 25 15:25:01 2012 +0100| [ea98fcfc60555b5f06a7149b8142be0bfcfb2be8] | committer: Felix Paul Kühne

macosx: fixed subtitle rendering resolution when using the native fullscreen mode (close #7946)

bug was triggered only when using controls provided by the OS like NSWindow's fullscreen button

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

 modules/gui/macosx/VideoView.m |   29 ++++++++++++++++++++++++++++-
 modules/gui/macosx/intf.m      |    5 ++---
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/VideoView.m b/modules/gui/macosx/VideoView.m
index c454c49..e711797 100644
--- a/modules/gui/macosx/VideoView.m
+++ b/modules/gui/macosx/VideoView.m
@@ -54,6 +54,8 @@
     if (p_vout)
         vlc_object_release(p_vout);
 
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+
     [self unregisterDraggedTypes];
     [super dealloc];
 }
@@ -67,6 +69,14 @@
     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;
 }
 
@@ -217,7 +227,7 @@
         i_yvlckey = KEY_MOUSEWHEELDOWN;
     else
         i_yvlckey = KEY_MOUSEWHEELUP;
-    
+
     if (f_deltaX < 0.0f)
         i_xvlckey = KEY_MOUSEWHEELRIGHT;
     else
@@ -286,6 +296,23 @@
 #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;
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 9727c95..fbfd1dd 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -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



More information about the vlc-commits mailing list