[vlc-commits] macosx: remove the fullscreen button from the main window when running on Lion, since NSWindowFullScreenButton is present in the window title

Felix Paul Kühne git at videolan.org
Tue Aug 16 22:18:50 CEST 2011


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Aug 16 20:28:05 2011 +0200| [cd34d65e9ac8c71598829f563bf48688dabe81c9] | committer: Felix Paul Kühne

macosx: remove the fullscreen button from the main window when running on Lion, since NSWindowFullScreenButton is present in the window title

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

 modules/gui/macosx/MainWindow.m |   55 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index b3c3cbe..2c2544f 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -156,8 +156,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]];
         [o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]];
         [o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]];
-        [o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons"]];
-        [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed"]];
+        if (OSX_LION)
+        {
+            [o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button"]];
+            [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-blue"]];
+        }
+        else
+        {
+            [o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons"]];
+            [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed"]];
+        }
         [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
         [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
         [o_time_sld_fancygradient_view loadImagesInDarkStyle:NO];
@@ -195,8 +203,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
         [o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
         [o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]];
-        [o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons_dark"]];
-        [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed_dark"]];
+        if (OSX_LION)
+        {
+            [o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button_dark"]];
+            [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-blue_dark"]];
+        }
+        else
+        {
+            [o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons_dark"]];
+            [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed_dark"]];            
+        }
         [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
         [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
         [o_time_sld_fancygradient_view loadImagesInDarkStyle:YES];
@@ -220,7 +236,38 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
     [o_dropzone_view setFrame: [o_playlist_table frame]];
     if (OSX_LION)
+    {
         [self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
+        NSRect frame;
+        float f_width = [o_fullscreen_btn frame].size.width;
+
+        #define moveItem( item ) \
+        frame = [item frame]; \
+        frame.origin.x = f_width + frame.origin.x; \
+        [item setFrame: frame]
+
+        moveItem( o_effects_btn );
+        moveItem( o_volume_up_btn );
+        moveItem( o_volume_sld );
+        moveItem( o_volume_track_view );
+        moveItem( o_volume_down_btn );
+        moveItem( o_time_fld );
+        moveItem( o_time_sld_right_view );
+        #undef moveItem
+
+        #define enlargeItem( item ) \
+        frame = [item frame]; \
+        frame.size.width = f_width + frame.size.width; \
+        [item setFrame: frame]
+
+        enlargeItem( o_time_sld );
+        enlargeItem( o_progress_bar );
+        enlargeItem( o_time_sld_middle_view );
+        enlargeItem( o_time_sld_fancygradient_view );
+        #undef enlargeItem
+
+        [o_fullscreen_btn removeFromSuperviewWithoutNeedingDisplay];
+    }
 
     /* create the sidebar */
     o_sidebaritems = [[NSMutableArray alloc] init];



More information about the vlc-commits mailing list