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 @@ ...@@ -33,6 +33,7 @@
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
...@@ -65,7 +66,7 @@ ...@@ -65,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
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
backing:(NSBackingStoreType)bufferingType backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag 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 setOpaque:NO];
[win setHasShadow: NO]; [win setHasShadow: NO];
[win setBackgroundColor:[NSColor clearColor]]; [win setBackgroundColor:[NSColor clearColor]];
...@@ -50,32 +50,16 @@ ...@@ -50,32 +50,16 @@
/* 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;
/* centre the panel in the lower third of the screen */ [win center];
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];
return win; return win;
} }
- (void)awakeFromNib - (void)awakeFromNib
{ {
[self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]]; [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]; [[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];
if (isInside) if (isInside)
[self mouseEntered:NULL]; [self mouseEntered:NULL];
...@@ -102,6 +86,27 @@ ...@@ -102,6 +86,27 @@
[super dealloc]; [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 - (void)setPlay
{ {
[[self contentView] setPlay]; [[self contentView] setPlay];
...@@ -210,6 +215,9 @@ ...@@ -210,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])
...@@ -292,9 +300,14 @@ ...@@ -292,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
...@@ -407,20 +420,14 @@ ...@@ -407,20 +420,14 @@
- (void)setPlay - (void)setPlay
{ {
NSImage *image; [o_play setImage:[NSImage imageNamed:@"fs_play"]];
image = [NSImage imageNamed:@"fs_play"]; [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_play_highlight"];
[o_play setAlternateImage:image];
} }
- (void)setPause - (void)setPause
{ {
NSImage *image; [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
image = [NSImage imageNamed:@"fs_pause"]; [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_pause_highlight"];
[o_play setAlternateImage:image];
} }
- (void)setStreamTitle:(NSString *)o_title - (void)setStreamTitle:(NSString *)o_title
...@@ -576,3 +583,4 @@ ...@@ -576,3 +583,4 @@
} }
@end @end
...@@ -946,17 +946,17 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -946,17 +946,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