Commit 85812c06 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* forwardport: [18319], [18320]

  - fspanel centering on right screen
  - fspanel don't hide if mousepointer is over fspanel
parent b99b38eb
......@@ -33,6 +33,7 @@
BOOL b_displayed;
BOOL b_voutWasUpdated;
int i_device;
}
- (id)initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
......@@ -65,7 +66,7 @@
- (void)mouseDragged:(NSEvent *)theEvent;
- (BOOL)isDisplayed;
- (void)setVoutWasUpdated;
- (void)setVoutWasUpdated: (int) i_screen;
@end
@interface VLCFSPanelView : NSView
......
......@@ -42,7 +42,7 @@
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
id win=[super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag];
id win = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag];
[win setOpaque:NO];
[win setHasShadow: NO];
[win setBackgroundColor:[NSColor clearColor]];
......@@ -50,32 +50,16 @@
/* let the window sit on top of everything else and start out completely transparent */
[win setLevel:NSFloatingWindowLevel];
[win setAlphaValue:0.0];
i_device = 0;
/* centre the panel in the lower third of the screen */
NSPoint theCoordinate;
NSRect theScreensFrame;
NSRect theWindowsFrame;
int i_outputScreen;
i_outputScreen = var_GetInteger( VLCIntf, "video-device" );
if( i_outputScreen <=0 || i_outputScreen > (signed int)[[NSScreen screens] count] )
/* invalid preferences or none specified, using main screen */
theScreensFrame = [[NSScreen mainScreen] frame];
else
/* user-defined screen */
theScreensFrame = [[[NSScreen screens] objectAtIndex: i_outputScreen] frame];
theWindowsFrame = [win frame];
theCoordinate.x = (theScreensFrame.size.width - theWindowsFrame.size.width) / 2;
theCoordinate.y = (theScreensFrame.size.height / 3) - theWindowsFrame.size.height;
[win setFrameTopLeftPoint: theCoordinate];
[win center];
return win;
}
- (void)awakeFromNib
{
[self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]];
BOOL isInside=(NSPointInRect([NSEvent mouseLocation],[self frame]));
BOOL isInside = (NSPointInRect([NSEvent mouseLocation],[self frame]));
[[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];
if (isInside)
[self mouseEntered:NULL];
......@@ -102,6 +86,27 @@
[super dealloc];
}
-(void)center
{
/* centre the panel in the lower third of the screen */
NSPoint theCoordinate;
NSRect theScreensFrame;
NSRect theWindowsFrame;
if( i_device < 0 || i_device >= (signed int)[[NSScreen screens] count] )
/* invalid preferences or none specified, using main screen */
theScreensFrame = [[NSScreen mainScreen] frame];
else
/* user-defined screen */
theScreensFrame = [[[NSScreen screens] objectAtIndex: i_device] frame];
theWindowsFrame = [self frame];
theCoordinate.x = (theScreensFrame.size.width - theWindowsFrame.size.width) / 2 + theScreensFrame.origin.x;
theCoordinate.y = (theScreensFrame.size.height / 3) - theWindowsFrame.size.height + theScreensFrame.origin.y;
[self setFrameTopLeftPoint: theCoordinate];
}
- (void)setPlay
{
[[self contentView] setPlay];
......@@ -210,6 +215,9 @@
- (void)fadeOut
{
if( NSPointInRect([NSEvent mouseLocation],[self frame]))
return;
if( ( [self alphaValue] > 0.0 ) )
{
if (![self fadeTimer])
......@@ -292,9 +300,14 @@
return b_displayed;
}
- (void)setVoutWasUpdated
- (void)setVoutWasUpdated: (int)i_newdevice;
{
b_voutWasUpdated = YES;
if( i_newdevice != i_device )
{
i_device = i_newdevice;
[self center];
}
}
@end
......@@ -407,20 +420,14 @@
- (void)setPlay
{
NSImage *image;
image = [NSImage imageNamed:@"fs_play"];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_play_highlight"];
[o_play setAlternateImage:image];
[o_play setImage:[NSImage imageNamed:@"fs_play"]];
[o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
}
- (void)setPause
{
NSImage *image;
image = [NSImage imageNamed:@"fs_pause"];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_pause_highlight"];
[o_play setAlternateImage:image];
[o_play setImage: [NSImage imageNamed:@"fs_pause"]];
[o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
}
- (void)setStreamTitle:(NSString *)o_title
......@@ -576,3 +583,4 @@
}
@end
......@@ -946,17 +946,17 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
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
* this won't and is not supposed to work when it's fading right now */
if( [[[[VLCMain sharedInstance] getControls] getFSPanel] isDisplayed] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self];
/* tell the fspanel to move itself to front next time it's triggered */
[[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated];
CGDisplayFadeReservationToken token;
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
[[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: i_device];
/* Creates a window with size: screen_rect on o_screen */
[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