]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/fspanel.m
macosx: do not start fullscreen when splitter is activated
[vlc] / modules / gui / macosx / fspanel.m
index f2f24334d2bb4e7c3f98a0a652be7ae9ee93a18b..e387ab3780666eab619e4f86b0024d974e62a434 100644 (file)
@@ -56,7 +56,7 @@
 
     /* let the window sit on top of everything else and start out completely transparent */
     [win setLevel:NSModalPanelWindowLevel];
-    i_device = 0;
+    i_device = config_GetInt(VLCIntf, "macosx-vdev");
     hideAgainTimer = fadeTimer = nil;
     [self setNonActive:nil];
     return win;
@@ -72,7 +72,8 @@
     if (!isInside)
         [self mouseExited:NULL];
 
-    [self center];
+    if (!OSX_SNOW_LEOPARD)
+        [self setAnimationBehavior:NSWindowAnimationBehaviorNone];
 
     /* get a notification if VLC isn't the active app anymore */
     [[NSNotificationCenter defaultCenter]
@@ -81,7 +82,8 @@
            name: NSApplicationDidResignActiveNotification
          object: NSApp];
 
-    /* get a notification if VLC is the active app again */
+    /* Get a notification if VLC is the active app again.
+     Needed as becomeKeyWindow does not get called when window is activated by clicking */
     [[NSNotificationCenter defaultCenter]
     addObserver: self
        selector: @selector(setActive:)
 - (void)setNonActive:(id)noData
 {
     b_nonActive = YES;
-    [self orderOut: self];
 
     /* here's fadeOut, just without visibly fading */
     b_displayed = NO;
     [self setAlphaValue:0.0];
     [self setFadeTimer:nil];
+
     b_fadeQueued = NO;
+
+    [self orderOut: self];
 }
 
 - (void)setActive:(id)noData
         b_voutWasUpdated = NO;
     }
 
-    if ([self alphaValue] < 1.0)
+    if ([self alphaValue] < 1.0) {
         [self setAlphaValue:[self alphaValue]+0.1];
+    }
     if ([self alphaValue] >= 1.0) {
         b_displayed = YES;
         [self setAlphaValue: 1.0];
         [self fadeIn];
         return;
     }
-    if ([self alphaValue] > 0.0)
+    if ([self alphaValue] > 0.0) {
         [self setAlphaValue:[self alphaValue]-0.05];
+    }
     if ([self alphaValue] <= 0.05) {
         b_displayed = NO;
         [self setAlphaValue:0.0];
 
     if ([self alphaValue] < 1.0 || b_displayed != YES) {
         if (![self fadeTimer])
-            [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithShort:1] repeats:YES]];
+            [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithInt:1] repeats:YES]];
         else if ([[[self fadeTimer] userInfo] shortValue]==0)
             b_fadeQueued=YES;
     }
 
     if (([self alphaValue] > 0.0)) {
         if (![self fadeTimer])
-            [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];
+            [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithInt:0] repeats:YES]];
         else if ([[[self fadeTimer] userInfo] shortValue]==1)
             b_fadeQueued=YES;
     }
     b_keptVisible = YES;
 
     /* get us a valid timer */
-    if (! b_alreadyCounting) {
+    if (!b_alreadyCounting) {
         i_timeToKeepVisibleInSec = var_CreateGetInteger(VLCIntf, "mouse-hide-timeout") / 500;
         if (hideAgainTimer) {
             [hideAgainTimer invalidate];
         [o_vout_window release];
     o_vout_window = [o_window retain];
     int i_newdevice = (int)[[o_vout_window screen] displayID];
-    if (i_newdevice != i_device) {
+    if ((i_newdevice != i_device && i_device != 0) || i_newdevice != [[self screen] displayID]) {
         i_device = i_newdevice;
         [self center];
-    }
+    } else
+        i_device = i_newdevice;
 }
 @end
 
     id view = [super initWithFrame:frameRect];
     fillColor = [[NSColor clearColor] retain];
     NSRect s_rc = [self frame];
-    addButton(o_prev, @"fs_skip_previous" , @"fs_skip_previous_highlight", 174, 15, prev, _NS("Click to go to the previous playlist item."), _NS("Previous"));
-    addButton(o_bwd, @"fs_rewind"        , @"fs_rewind_highlight"       , 211, 14, backward, _NS("Click and hold to skip backward through the current media."), _NS("Backward"));
-    addButton(o_play, @"fs_play"          , @"fs_play_highlight"         , 267, 10, play, _NS("Click to play or pause the current media."), _NS("Play/Pause"));
-    addButton(o_fwd, @"fs_forward"       , @"fs_forward_highlight"      , 313, 14, forward, _NS("Click and hold to skip forward through the current media."), _NS("Forward"));
-    addButton(o_next, @"fs_skip_next"     , @"fs_skip_next_highlight"    , 365, 15, next, _NS("Click to go to the next playlist item."), _NS("Next"));
-    addButton(o_fullscreen, @"fs_exit_fullscreen", @"fs_exit_fullscreen_hightlight", 507, 13, toggleFullscreen, _NS("Click to exit fullscreen playback."), _NS("Toggle Fullscreen mode"));
+    addButton(o_prev, @"fs_skip_previous_highlight" , @"fs_skip_previous", 174, 15, prev, _NS("Click to go to the previous playlist item."), _NS("Previous"));
+    addButton(o_bwd, @"fs_rewind_highlight"        , @"fs_rewind"       , 211, 14, backward, _NS("Click and hold to skip backward through the current media."), _NS("Backward"));
+    addButton(o_play, @"fs_play_highlight"          , @"fs_play"         , 265, 10, play, _NS("Click to play or pause the current media."), _NS("Play/Pause"));
+    addButton(o_fwd, @"fs_forward_highlight"       , @"fs_forward"      , 313, 14, forward, _NS("Click and hold to skip forward through the current media."), _NS("Forward"));
+    addButton(o_next, @"fs_skip_next_highlight"     , @"fs_skip_next"    , 365, 15, next, _NS("Click to go to the next playlist item."), _NS("Next"));
+    addButton(o_fullscreen, @"fs_exit_fullscreen_highlight", @"fs_exit_fullscreen", 507, 13, toggleFullscreen, _NS("Click to exit fullscreen playback."), _NS("Toggle Fullscreen mode"));
 /*
     addButton(o_button, @"image (off state)", @"image (on state)", 38, 51, something, accessibility help string, usual tool tip);
  */
     /* volume slider */
     s_rc = [self frame];
     s_rc.origin.x = 26;
-    s_rc.origin.y = 21;
+    s_rc.origin.y = 20;
     s_rc.size.width = 95;
-    s_rc.size.height = 10;
+    s_rc.size.height = 12;
     o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
     [o_fs_volumeSlider setMinValue:0];
-    [o_fs_volumeSlider setMaxValue:AOUT_VOLUME_MAX];
+    [o_fs_volumeSlider setMaxValue: [[VLCCoreInteraction sharedInstance] maxVolume]];
     [o_fs_volumeSlider setIntValue:AOUT_VOLUME_DEFAULT];
     [o_fs_volumeSlider setContinuous: YES];
     [o_fs_volumeSlider setTarget: self];
     [o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];
+    [o_fs_volumeSlider setUsesBrightArtwork:NO];
     [[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Volume") forAttribute:NSAccessibilityTitleAttribute];
     [[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change the volume.") forAttribute:NSAccessibilityDescriptionAttribute];
     [self addSubview: o_fs_volumeSlider];
 
     o_background_img = [[NSImage imageNamed:@"fs_background"] retain];
     o_vol_sld_img = [[NSImage imageNamed:@"fs_volume_slider_bar"] retain];
-    o_vol_mute_img = [[NSImage imageNamed:@"fs_volume_mute"] retain];
-    o_vol_max_img = [[NSImage imageNamed:@"fs_volume_max"] retain];
+    o_vol_mute_img = [[NSImage imageNamed:@"fs_volume_mute_highlight"] retain];
+    o_vol_max_img = [[NSImage imageNamed:@"fs_volume_max_highlight"] retain];
     o_time_sld_img = [[NSImage imageNamed:@"fs_time_slider"] retain];
 
     return view;
 
 - (void)setPlay
 {
-    [o_play setImage:[NSImage imageNamed:@"fs_play"]];
-    [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
+    [o_play setImage:[NSImage imageNamed:@"fs_play_highlight"]];
+    [o_play setAlternateImage: [NSImage imageNamed:@"fs_play"]];
 }
 
 - (void)setPause
 {
-    [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
-    [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
+    [o_play setImage: [NSImage imageNamed:@"fs_pause_highlight"]];
+    [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause"]];
 }
 
 - (void)setStreamTitle:(NSString *)o_title
                     remaining = dur - time.i_time;
                 o_total_time = [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
             } else
-                o_total_time = [NSString stringWithUTF8String: secstotimestr(psz_time, (dur / 1000000))];
+                o_total_time = [NSString stringWithUTF8String:secstotimestr(psz_time, (dur / 1000000))];
 
             [o_streamLength_txt setStringValue: o_total_time];
         }
 
         // update current position (left field)
-        NSString *o_playback_pos = [NSString stringWithUTF8String: secstotimestr(psz_time, (time.i_time / 1000000))];
+        NSString *o_playback_pos = [NSString stringWithUTF8String:secstotimestr(psz_time, (time.i_time / 1000000))];
                
         [o_streamPosition_txt setStringValue: o_playback_pos];
         vlc_object_release(p_input);
 * VLCFSVolumeSlider
 *****************************************************************************/
 @implementation VLCFSVolumeSlider
+
+- (id)initWithFrame:(NSRect)frame
+{
+    self = [super initWithFrame:frame];
+    if(self) {
+        [self setCell:[[[VolumeSliderCell alloc] init] autorelease]];
+    }
+
+    return self;
+}
+
 - (void)drawKnobInRect:(NSRect) knobRect
 {
     NSRect image_rect;
-    NSImage *img = [NSImage imageNamed:@"fs_volume_slider_knob"];
+    NSImage *img = [NSImage imageNamed:@"fs_volume_slider_knob_highlight"];
     image_rect.size = [img size];
     image_rect.origin.x = 0;
     image_rect.origin.y = 0;
     [super drawRect:rect];
     [[NSGraphicsContext currentContext] restoreGraphicsState];
 
+    [self drawFullVolumeMarker];
+
     NSRect knobRect = [[self cell] knobRectFlipped:NO];
     knobRect.origin.y+=7.5;
     [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
     [self drawKnobInRect: knobRect];
 }
 
+- (void)drawFullVolBezierPath:(NSBezierPath*)bezierPath
+{
+    CGFloat fullVolPos = [self fullVolumePos];
+    [bezierPath moveToPoint:NSMakePoint(fullVolPos, [self frame].size.height)];
+    [bezierPath lineToPoint:NSMakePoint(fullVolPos, 1.)];
+}
+
 @end