Commit aa742bd4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* fix a nasty handling bug and convert all comments to C-style

parent 7a57427b
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#import "intf.h" #import "intf.h"
#import "controls.h"
#import "vout.h"
#import "fspanel.h" #import "fspanel.h"
#define KEEP_VISIBLE_AFTER_ACTION 4 /* time in half-sec until this panel will hide again after an user's action */ #define KEEP_VISIBLE_AFTER_ACTION 4 /* time in half-sec until this panel will hide again after an user's action */
...@@ -34,7 +36,7 @@ ...@@ -34,7 +36,7 @@
* VLCFSPanel * VLCFSPanel
*****************************************************************************/ *****************************************************************************/
@implementation VLCFSPanel @implementation VLCFSPanel
// We override this initializer so we can set the NSBorderlessWindowMask styleMask, and set a few other important settings /* We override this initializer so we can set the NSBorderlessWindowMask styleMask, and set a few other important settings */
- (id)initWithContentRect:(NSRect)contentRect - (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType backing:(NSBackingStoreType)bufferingType
...@@ -44,8 +46,9 @@ ...@@ -44,8 +46,9 @@
[win setOpaque:NO]; [win setOpaque:NO];
[win setHasShadow: NO]; [win setHasShadow: NO];
[win setBackgroundColor:[NSColor clearColor]]; [win setBackgroundColor:[NSColor clearColor]];
[win setLevel:NSFloatingWindowLevel]; // Let's make it sit on top of everything else /* let the window sit on top of everything else and start out completely transparent */
[win setAlphaValue:0.2]; // It'll start out mostly transparent [win setLevel:NSFloatingWindowLevel];
[win setAlphaValue:0.0];
return win; return win;
} }
...@@ -60,7 +63,7 @@ ...@@ -60,7 +63,7 @@
[self mouseExited:NULL]; [self mouseExited:NULL];
} }
// Windows created with NSBorderlessWindowMask normally can't be key, but we want ours to be /* Windows created with NSBorderlessWindowMask normally can't be key, but we want ours to be */
- (BOOL)canBecomeKeyWindow - (BOOL)canBecomeKeyWindow
{ {
return YES; return YES;
...@@ -94,7 +97,7 @@ ...@@ -94,7 +97,7 @@
[[self contentView] setStreamPos:f_pos setSeconds:i_seconds]; [[self contentView] setStreamPos:f_pos setSeconds:i_seconds];
} }
// This routine is called repeatedly when the mouse enters the window from outside it. /* This routine is called repeatedly when the mouse enters the window from outside it. */
- (void)focus:(NSTimer *)timer - (void)focus:(NSTimer *)timer
{ {
if( [self alphaValue] < 1.0 ) if( [self alphaValue] < 1.0 )
...@@ -111,7 +114,7 @@ ...@@ -111,7 +114,7 @@
} }
} }
// This routine is called repeatedly when the mouse exits the window from inside it. /* This routine is called repeatedly when the mouse exits the window from inside it */
- (void)unfocus:(NSTimer *)timer - (void)unfocus:(NSTimer *)timer
{ {
if( [self alphaValue] > 0.0 ) if( [self alphaValue] > 0.0 )
...@@ -133,13 +136,13 @@ ...@@ -133,13 +136,13 @@
} }
} }
// If the mouse enters a window, go make sure we fade in /* If the mouse enters a window, go make sure we fade in */
- (void)mouseEntered:(NSEvent *)theEvent - (void)mouseEntered:(NSEvent *)theEvent
{ {
[self fadeIn]; [self fadeIn];
} }
// If the mouse exits a window, go make sure we fade out /* If the mouse exits a window, go make sure we fade out */
- (void)mouseExited:(NSEvent *)theEvent - (void)mouseExited:(NSEvent *)theEvent
{ {
/* the user left the window, fade out immediatelly and prevent any timer action */ /* the user left the window, fade out immediatelly and prevent any timer action */
...@@ -151,6 +154,10 @@ ...@@ -151,6 +154,10 @@
hideAgainTimer = NULL; hideAgainTimer = NULL;
} }
/* give up our focus, so the vout may show us again without letting the user clicking it */
if( [[[[VLCMain sharedInstance] getControls] getVoutView] isFullscreen] )
[[[[[VLCMain sharedInstance] getControls] getVoutView] window] makeKeyWindow];
[self fadeOut]; [self fadeOut];
} }
...@@ -168,7 +175,7 @@ ...@@ -168,7 +175,7 @@
- (void)fadeOut - (void)fadeOut
{ {
if(( [self alphaValue] > 0.0 ) && !NSPointInRect( [NSEvent mouseLocation], [self frame] ) ) if( ( [self alphaValue] > 0.0 ) && !NSPointInRect( [NSEvent mouseLocation], [self frame] ) )
{ {
if (![self fadeTimer]) if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]]; [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];
...@@ -218,7 +225,7 @@ ...@@ -218,7 +225,7 @@
} }
} }
// A getter and setter for our main timer that handles window fading /* A getter and setter for our main timer that handles window fading */
- (NSTimer *)fadeTimer - (NSTimer *)fadeTimer
{ {
return fadeTimer; return fadeTimer;
...@@ -293,7 +300,9 @@ ...@@ -293,7 +300,9 @@
addButton( o_fast, @"FSFastForwardOff.tif" , @"FSFastForwardOn.tif" , 238, 37, faster ); addButton( o_fast, @"FSFastForwardOff.tif" , @"FSFastForwardOn.tif" , 238, 37, faster );
addButton( o_next, @"FSGotoEndOff.tif" , @"FSGotoEndOn.tif" , 286, 37, next ); addButton( o_next, @"FSGotoEndOff.tif" , @"FSGotoEndOn.tif" , 286, 37, next );
addButton( o_fullscreen, @"FSExitOff.tif", @"FSExitOn.tif", 382, 45, windowAction ); addButton( o_fullscreen, @"FSExitOff.tif", @"FSExitOn.tif", 382, 45, windowAction );
// addButton( o_button, @"FSVolumeThumbOff.tif" , @"FSVolumeThumbOn.tif" , 38, 51, something ); /*
addButton( o_button, @"FSVolumeThumbOff.tif" , @"FSVolumeThumbOn.tif" , 38, 51, something );
*/
s_rc = [self frame]; s_rc = [self frame];
s_rc.origin.x = 25; s_rc.origin.x = 25;
...@@ -440,7 +449,7 @@ void drawKnobInRect(NSRect knobRect) ...@@ -440,7 +449,7 @@ void drawKnobInRect(NSRect knobRect)
void drawFrameInRect(NSRect frameRect) void drawFrameInRect(NSRect frameRect)
{ {
// Draw frame /* Draw frame */
NSBundle *bundle = [NSBundle mainBundle]; NSBundle *bundle = [NSBundle mainBundle];
NSRect frame = frameRect; NSRect frame = frameRect;
NSRect image_rect; NSRect image_rect;
...@@ -452,7 +461,7 @@ void drawFrameInRect(NSRect frameRect) ...@@ -452,7 +461,7 @@ void drawFrameInRect(NSRect frameRect)
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect
{ {
// Draw default to make sure the slider behaves correctly /* Draw default to make sure the slider behaves correctly */
[[NSGraphicsContext currentContext] saveGraphicsState]; [[NSGraphicsContext currentContext] saveGraphicsState];
NSRectClip(NSZeroRect); NSRectClip(NSZeroRect);
[super drawRect:rect]; [super drawRect:rect];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment