Commit d77c16d3 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Better center for the fspanel.

* Don't hide if the mousepointer is over the fspanel
parent aefb8674
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
BOOL b_keptVisible; BOOL b_keptVisible;
BOOL b_alreadyCounting; BOOL b_alreadyCounting;
int i_timeToKeepVisibleInSec; int i_timeToKeepVisibleInSec;
int i_outputScreen;
BOOL b_displayed; BOOL b_displayed;
BOOL b_voutWasUpdated; BOOL b_voutWasUpdated;
int i_device;
} }
- (id)initWithContentRect: (NSRect)contentRect - (id)initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle styleMask: (unsigned int)aStyle
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
- (void)mouseDragged:(NSEvent *)theEvent; - (void)mouseDragged:(NSEvent *)theEvent;
- (BOOL)isDisplayed; - (BOOL)isDisplayed;
- (void)setVoutWasUpdated; - (void)setVoutWasUpdated: (int) i_screen;
@end @end
@interface VLCFSPanelView : NSView @interface VLCFSPanelView : NSView
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
/* let the window sit on top of everything else and start out completely transparent */ /* let the window sit on top of everything else and start out completely transparent */
[win setLevel:NSFloatingWindowLevel]; [win setLevel:NSFloatingWindowLevel];
[win setAlphaValue:0.0]; [win setAlphaValue:0.0];
i_device = 0;
[win center]; [win center];
return win; return win;
...@@ -91,15 +92,13 @@ ...@@ -91,15 +92,13 @@
NSPoint theCoordinate; NSPoint theCoordinate;
NSRect theScreensFrame; NSRect theScreensFrame;
NSRect theWindowsFrame; NSRect theWindowsFrame;
i_outputScreen = var_GetInteger( VLCIntf->p_vlc, "video-device" );
if( i_outputScreen <= 0 || i_outputScreen > (signed int)[[NSScreen screens] count] ) if( i_device < 0 || i_device >= (signed int)[[NSScreen screens] count] )
/* invalid preferences or none specified, using main screen */ /* invalid preferences or none specified, using main screen */
theScreensFrame = [[NSScreen mainScreen] frame]; theScreensFrame = [[NSScreen mainScreen] frame];
else else
/* user-defined screen */ /* user-defined screen */
theScreensFrame = [[[NSScreen screens] objectAtIndex: i_outputScreen-1] frame]; theScreensFrame = [[[NSScreen screens] objectAtIndex: i_device] frame];
theWindowsFrame = [self frame]; theWindowsFrame = [self frame];
...@@ -204,9 +203,6 @@ ...@@ -204,9 +203,6 @@
- (void)fadeIn - (void)fadeIn
{ {
if( i_outputScreen != var_GetInteger( VLCIntf->p_vlc, "video-device" ) )
[self center];
if( [self alphaValue] < 1.0 ) if( [self alphaValue] < 1.0 )
{ {
if (![self fadeTimer]) if (![self fadeTimer])
...@@ -219,6 +215,9 @@ ...@@ -219,6 +215,9 @@
- (void)fadeOut - (void)fadeOut
{ {
if( NSPointInRect([NSEvent mouseLocation],[self frame]))
return;
if( ( [self alphaValue] > 0.0 ) ) if( ( [self alphaValue] > 0.0 ) )
{ {
if (![self fadeTimer]) if (![self fadeTimer])
...@@ -301,9 +300,14 @@ ...@@ -301,9 +300,14 @@
return b_displayed; return b_displayed;
} }
- (void)setVoutWasUpdated - (void)setVoutWasUpdated: (int)i_newdevice;
{ {
b_voutWasUpdated = YES; b_voutWasUpdated = YES;
if( i_newdevice != i_device )
{
i_device = i_newdevice;
[self center];
}
} }
@end @end
......
...@@ -933,17 +933,17 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -933,17 +933,17 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
CGDisplayFadeReservationToken token;
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* move the FSPanel to front in case that it is currently shown /* move the FSPanel to front in case that it is currently shown
* this won't and is not supposed to work when it's fading right now */ * this won't and is not supposed to work when it's fading right now */
if( [[[[VLCMain sharedInstance] getControls] getFSPanel] isDisplayed] ) if( [[[[VLCMain sharedInstance] getControls] getFSPanel] isDisplayed] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self]; [[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self];
/* tell the fspanel to move itself to front next time it's triggered */ /* tell the fspanel to move itself to front next time it's triggered */
[[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated]; [[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: i_device];
CGDisplayFadeReservationToken token;
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* Creates a window with size: screen_rect on o_screen */ /* Creates a window with size: screen_rect on o_screen */
[self initWithContentRect: screen_rect [self initWithContentRect: screen_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