[vlc-commits] commit: legacy OS X intf: restored 1.0 look of the video output window ( Felix Paul Kühne )

git at videolan.org git at videolan.org
Sat Mar 13 21:19:44 CET 2010


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Mar 13 21:18:36 2010 +0100| [4647e341e9fc829795b575397b5bad8b87eab049] | committer: Felix Paul Kühne 

legacy OS X intf: restored 1.0 look of the video output window

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

 modules/gui/macosx/embeddedwindow.m |   53 +++++++++++++++++++++--------------
 1 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m
index fb5d4c3..50c1f02 100644
--- a/modules/gui/macosx/embeddedwindow.m
+++ b/modules/gui/macosx/embeddedwindow.m
@@ -37,26 +37,30 @@
 #import <Carbon/Carbon.h>
 
 /*****************************************************************************
- * extension to NSWindow's interface to fix compilation warnings
- * and let us access this functions properly
- * this uses a private Apple-API, but works fine on all current OSX releases
- * keep checking for compatiblity with future releases though
- *****************************************************************************/
-
- at interface NSWindow (UndocumentedWindowProperties)
-- (void)setBottomCornerRounded: (BOOL)value;
- at end
-
-/*****************************************************************************
  * VLCEmbeddedWindow Implementation
  *****************************************************************************/
 
 @implementation VLCEmbeddedWindow
 
+- (id)initWithContentRect:(NSRect)contentRect styleMask: (NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
+{
+    BOOL b_useTextured = YES;
+    if( [[NSWindow class] instancesRespondToSelector:@selector(setContentBorderThickness:forEdge:)] )
+    {
+        b_useTextured = NO;
+        windowStyle ^= NSTexturedBackgroundWindowMask;
+    }
+    self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
+    if(! b_useTextured )
+    {
+        [self setContentBorderThickness:28.0 forEdge:NSMinYEdge];
+    }
+    return self;
+}
+
 - (void)awakeFromNib
 {
     [self setDelegate: self];
-    [self setBottomCornerRounded:NO];
 
     /* button strings */
     [o_btn_backward setToolTip: _NS("Rewind")];
@@ -100,9 +104,13 @@
     [o_btn_fullscreen setState: NO];
     b_fullscreen = NO;
 
+    [self setMovableByWindowBackground:YES];
+
+    [self setDelegate:self];
+
     /* Make sure setVisible: returns NO */
     [self orderOut:self];
-    //b_window_is_invisible = YES;
+    b_window_is_invisible = YES;
     videoRatio = NSMakeSize( 0., 0. );
 }
 
@@ -112,12 +120,19 @@
     if( [o_btn_play alternateImage] == o_img_play_pressed )
         b_playing = YES;
 
-    if( [NSColor currentControlTint] == NSGraphiteControlTint ) {
+    if( [NSColor currentControlTint] == NSGraphiteControlTint )
+    {
         o_img_play_pressed = [NSImage imageNamed: @"play_embedded_graphite"];
         o_img_pause_pressed = [NSImage imageNamed: @"pause_embedded_graphite"];
+        [o_btn_backward setAlternateImage: [NSImage imageNamed: @"skip_previous_embedded_graphite"]];
+        [o_btn_forward setAlternateImage: [NSImage imageNamed: @"skip_forward_embedded_graphite"]];
+        [o_btn_fullscreen setAlternateImage: [NSImage imageNamed: @"fullscreen_graphite"]];
     } else {
-        o_img_play_pressed = [NSImage imageNamed:@"play_embedded_blue"];
-        o_img_pause_pressed = [NSImage imageNamed:@"pause_embedded_blue"];
+        o_img_play_pressed = [NSImage imageNamed: @"play_embedded_blue"];
+        o_img_pause_pressed = [NSImage imageNamed: @"pause_embedded_blue"];
+        [o_btn_backward setAlternateImage: [NSImage imageNamed: @"skip_previous_embedded_blue"]];
+        [o_btn_forward setAlternateImage: [NSImage imageNamed: @"skip_forward_embedded_blue"]];
+        [o_btn_fullscreen setAlternateImage: [NSImage imageNamed: @"fullscreen_blue"]];
     }
 
     if( b_playing )
@@ -213,10 +228,8 @@
 - (BOOL)windowShouldClose:(id)sender
 {
     playlist_t * p_playlist = pl_Get( VLCIntf );
+    playlist_Stop( p_playlist );
 
-    /* Only want to stop playback if video is playing */
-    if( videoRatio.height != 0. && videoRatio.width != 0. )
-        playlist_Stop( p_playlist );
     return YES;
 }
 
@@ -456,8 +469,6 @@
             [o_fullscreen_window setContentView:o_view];
 
             [o_fullscreen_window makeKeyAndOrderFront:self];
-
-            [o_fullscreen_window makeKeyAndOrderFront:self];
             [o_fullscreen_window orderFront:self animate:YES];
 
             [o_fullscreen_window setFrame:screen_rect display:YES];



More information about the vlc-commits mailing list