]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/misc.m
Move last.fm password from PasswordShowOnEdit to Password.
[vlc] / modules / gui / macosx / misc.m
index dc011bcf816faffcd61ad85a9afdfaf3a5712bb7..a4deccee74cebd3275c120d88890ece52ddb6af2 100644 (file)
@@ -1,10 +1,11 @@
 /*****************************************************************************
  * misc.m: code not specific to vlc
  *****************************************************************************
- * Copyright (C) 2003-2007 the VideoLAN team
+ * Copyright (C) 2003-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
+ *          Felix Paul Kühne <fkuehne at videolan dot org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
+#import <QuickTime/QuickTime.h>
 
-#include "intf.h"                                          /* VLCApplication */
-#include "misc.h"
-#include "playlist.h"
-#include "controls.h"
+#import "intf.h"                                          /* VLCApplication */
+#import "misc.h"
+#import "playlist.h"
+#import "controls.h"
 
 /*****************************************************************************
  * NSAnimation (VLCAdditions)
@@ -113,7 +115,6 @@ static NSMutableArray *blackoutWindows = NULL;
     [blackoutWindows makeObjectsPerformSelector:@selector(close)];
     [blackoutWindows removeAllObjects];
 
     for(i = 0; i < [[NSScreen screens] count]; i++)
     {
         NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
@@ -124,7 +125,7 @@ static NSMutableArray *blackoutWindows = NULL;
             continue;
 
         screen_rect = [screen frame];
-        screen_rect.origin.x = screen_rect.origin.y = 0.0f;
+        screen_rect.origin.x = screen_rect.origin.y = 0;
 
         /* blackoutWindow alloc strategy
             - The NSMutableArray blackoutWindows has the blackoutWindow references
@@ -135,10 +136,14 @@ static NSMutableArray *blackoutWindows = NULL;
         [blackoutWindow setBackgroundColor:[NSColor blackColor]];
         [blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */
  
+        [blackoutWindow displayIfNeeded];
         [blackoutWindow orderFront: self animate: YES];
 
         [blackoutWindows addObject: blackoutWindow];
         [blackoutWindow release];
+        
+        if( [screen isMainScreen ] )
+           SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
     }
 }
 
@@ -151,6 +156,8 @@ static NSMutableArray *blackoutWindows = NULL;
         VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
         [blackoutWindow closeAndAnimate: YES];
     }
+    
+   SetSystemUIMode( kUIModeNormal, 0);
 }
 
 @end
@@ -635,14 +642,27 @@ void _drawFrameInRect(NSRect frameRect)
 - (id)init
 {
     self = [super init];
-    _knobOff = [[NSImage imageNamed:@"volumeslider_normal"] retain];
-    _knobOn = [[NSImage imageNamed:@"volumeslider_blue"] retain];
+    _knobOff = [NSImage imageNamed:@"volumeslider_normal"];
+    [self controlTintChanged];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+                                             selector: @selector( controlTintChanged )
+                                                 name: NSControlTintDidChangeNotification
+                                               object: nil];
     b_mouse_down = FALSE;
     return self;
 }
 
+- (void)controlTintChanged
+{
+    if( [NSColor currentControlTint] == NSGraphiteControlTint )
+        _knobOn = [NSImage imageNamed:@"volumeslider_graphite"];
+    else
+        _knobOn = [NSImage imageNamed:@"volumeslider_blue"];
+}
+
 - (void)dealloc
 {
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
     [_knobOff release];
     [_knobOn release];
     [super dealloc];