[vlc-commits] macosx: add black view to detached video view in order to avoid flashes

David Fuhrmann git at videolan.org
Sat Oct 6 16:49:42 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Oct  6 16:49:04 2012 +0200| [4b23d65e2b28be6e79507472ad7c7a757620ad81] | committer: David Fuhrmann

macosx: add black view to detached video view in order to avoid flashes

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

 modules/gui/macosx/MainWindow.h |    3 +++
 modules/gui/macosx/MainWindow.m |   17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index c4ff256..c332fec 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -159,5 +159,8 @@
 @end
 
 @interface VLCDetachedVideoWindow : VLCVideoWindowCommon
+{
+    VLCColorView * o_color_backdrop;
+}
 
 @end
\ No newline at end of file
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 24a7495..6f3c75e 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1762,8 +1762,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
 {
     [self setAcceptsMouseMovedEvents: YES];
 
-    [self setBackgroundColor: [NSColor blackColor]];
     if (b_dark_interface) {
+        [self setBackgroundColor: [NSColor clearColor]];
+
         [self setOpaque: NO];
         [self display];
         [self setHasShadow:NO];
@@ -1778,6 +1779,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
         // native fs not supported with detached view yet
         [o_titlebar_view setFullscreenButtonHidden: YES];
+    } else {
+        [self setBackgroundColor: [NSColor blackColor]];
     }
 
     NSRect videoViewRect = [[self contentView] bounds];
@@ -1789,10 +1792,22 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [o_video_view setFrame: videoViewRect];
 
     if (b_dark_interface) {
+        o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_video_view frame]];
+        [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_video_view];
+        [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
+
         [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
     } else {
         [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height)];
     }
 }
 
+- (void)dealloc
+{
+    if (b_dark_interface)
+        [o_color_backdrop release];
+
+    [super dealloc];
+}
+
 @end



More information about the vlc-commits mailing list