[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 21:14:41 CET 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Dec 25 15:25:01 2012 +0100| [cab9d6cb04488f57382d12da7d2abaada20936fc] | 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
(cherry picked from commit ea98fcfc60555b5f06a7149b8142be0bfcfb2be8)

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

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

 NEWS                           |    2 ++
 modules/gui/macosx/VideoView.m |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/NEWS b/NEWS
index 7b7490f..abd4d7a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 Changes between 2.0.5 and 2.0.6:
 --------------------------------
 
+Mac OS X:
+ * Fix subtitle rendering resolution when using OS X's native fullscreen mode
 
 Changes between 2.0.4 and 2.0.5:
 --------------------------------
diff --git a/modules/gui/macosx/VideoView.m b/modules/gui/macosx/VideoView.m
index bea8557..3766d49 100644
--- a/modules/gui/macosx/VideoView.m
+++ b/modules/gui/macosx/VideoView.m
@@ -68,15 +68,42 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (void)dealloc
 {
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+
     [self unregisterDraggedTypes];
     [super dealloc];
 }
 
 - (void)awakeFromNib
 {
+#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
+
     [self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
 }
 
+- (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];
+    }
+}
+
 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
 {
     if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)



More information about the vlc-commits mailing list