[vlc-commits] macosx: prevent ugly rendering artifacts when resizing the black main window on a slow CPU by adding a black backdrop on top of the clear window background
Felix Paul Kühne
git at videolan.org
Wed Jan 11 21:40:53 CET 2012
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jan 11 21:40:38 2012 +0100| [498f15b30a450919f0e2a76ba102e431c8f01859] | committer: Felix Paul Kühne
macosx: prevent ugly rendering artifacts when resizing the black main window on a slow CPU by adding a black backdrop on top of the clear window background
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=498f15b30a450919f0e2a76ba102e431c8f01859
---
modules/gui/macosx/MainWindow.h | 2 ++
modules/gui/macosx/MainWindow.m | 8 +++++++-
modules/gui/macosx/MainWindowTitle.h | 6 +++++-
modules/gui/macosx/MainWindowTitle.m | 18 +++++++++++++++++-
modules/gui/macosx/simple_prefs.m | 2 ++
5 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 44b2438..5ed8324 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -30,6 +30,7 @@
#import <vlc_input.h>
#import "misc.h"
#import "fspanel.h"
+#import "MainWindowTitle.h"
@interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_play_btn;
@@ -112,6 +113,7 @@
NSTimer *t_hide_mouse_timer;
+ VLCColorView * o_color_backdrop;
NSInteger i_originalLevel;
NSRect previousSavedFrame;
}
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 186392d..ea804c2 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -33,7 +33,6 @@
#import "open.h"
#import "controls.h" // TODO: remove me
#import "SideBarItem.h"
-#import "MainWindowTitle.h"
#import <vlc_playlist.h>
#import <vlc_aout_intf.h>
#import <vlc_url.h>
@@ -109,6 +108,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)dealloc
{
+ if (b_dark_interface)
+ [o_color_backdrop release];
+
[[NSNotificationCenter defaultCenter] removeObserver: self];
config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
[self saveFrameUsingName: [self frameAutosaveName]];
@@ -424,6 +426,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_video_view setFrame: winrect];
previousSavedFrame = winrect;
+ o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
+ [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
+ [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
+
[self display];
}
else
diff --git a/modules/gui/macosx/MainWindowTitle.h b/modules/gui/macosx/MainWindowTitle.h
index ecbdd3e..7180850 100644
--- a/modules/gui/macosx/MainWindowTitle.h
+++ b/modules/gui/macosx/MainWindowTitle.h
@@ -1,7 +1,7 @@
/*****************************************************************************
* MainWindowTitle.h: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2011 Felix Paul Kühne
+ * Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
@@ -64,5 +64,9 @@
@interface VLCResizeControl : NSImageView
{
}
+ at end
+ at interface VLCColorView : NSView
+{
+}
@end
diff --git a/modules/gui/macosx/MainWindowTitle.m b/modules/gui/macosx/MainWindowTitle.m
index 9b883d0..d8800df 100644
--- a/modules/gui/macosx/MainWindowTitle.m
+++ b/modules/gui/macosx/MainWindowTitle.m
@@ -1,7 +1,7 @@
/*****************************************************************************
* MainWindowTitle.m: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2011 Felix Paul Kühne
+ * Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
@@ -272,3 +272,19 @@
}
@end
+
+/*****************************************************************************
+ * VLCColorView
+ *
+ * since we are using a clear window color when using the black window
+ * style, some filling is needed behind the video and some other elements
+ *****************************************************************************/
+
+ at implementation VLCColorView
+
+- (void)drawRect:(NSRect)rect {
+ [[NSColor blackColor] setFill];
+ NSRectFill(rect);
+}
+
+ at end
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 02af0a0..3513f32 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -133,6 +133,8 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
if (OSX_LION)
[o_sprefs_win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+ else
+ [o_intf_nativefullscreen_ckb setEnabled:NO];
#ifndef MAC_OS_X_VERSION_10_7
[o_intf_nativefullscreen_ckb setEnabled:NO];
#endif
More information about the vlc-commits
mailing list