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

mac plugin: hide toolbar after going fullscreen

parent aab86000
...@@ -115,6 +115,8 @@ CGImageRef createImageNamed(NSString *); ...@@ -115,6 +115,8 @@ CGImageRef createImageNamed(NSString *);
} }
@property (readwrite) VlcPluginMac * cppPlugin; @property (readwrite) VlcPluginMac * cppPlugin;
- (void)hideToolbar;
@end @end
@interface VLCFullscreenWindow : NSWindow { @interface VLCFullscreenWindow : NSWindow {
...@@ -204,6 +206,8 @@ void VlcPluginMac::toggle_fullscreen() ...@@ -204,6 +206,8 @@ void VlcPluginMac::toggle_fullscreen()
[[(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenView].layer setNeedsDisplay]; [[(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenView].layer setNeedsDisplay];
[[(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenWindow].contentView enterFullScreenMode: [NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: 0], NSFullScreenModeAllScreens, nil]]; [[(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenWindow].contentView enterFullScreenMode: [NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: 0], NSFullScreenModeAllScreens, nil]];
[[(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenView] performSelector:@selector(hideToolbar) withObject:nil afterDelay: 4.1];
} else { } else {
if (![(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenWindow]) if (![(VLCPerInstanceStorage *)this->_perInstanceStorage fullscreenWindow])
return; return;
...@@ -1023,7 +1027,7 @@ bool VlcPluginMac::handle_event(void *event) ...@@ -1023,7 +1027,7 @@ bool VlcPluginMac::handle_event(void *event)
{ {
self.cppPlugin->set_toolbar_visible(true); self.cppPlugin->set_toolbar_visible(true);
_timeSinceLastMouseMove = [NSDate timeIntervalSinceReferenceDate]; _timeSinceLastMouseMove = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(hideToolbar) withObject:nil afterDelay: 4.1]; [self performSelector:@selector(_hideToolbar) withObject:nil afterDelay: 4.1];
if ([(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] != nil) { if ([(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] != nil) {
if ([[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] respondsToSelector:@selector(mouseMovedToX:Y:)]) { if ([[(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage playbackLayer] respondsToSelector:@selector(mouseMovedToX:Y:)]) {
...@@ -1035,12 +1039,16 @@ bool VlcPluginMac::handle_event(void *event) ...@@ -1035,12 +1039,16 @@ bool VlcPluginMac::handle_event(void *event)
[super mouseMoved: theEvent]; [super mouseMoved: theEvent];
} }
- (void)_hideToolbar
{
if ([NSDate timeIntervalSinceReferenceDate] - _timeSinceLastMouseMove >= 4)
[self hideToolbar];
}
- (void)hideToolbar - (void)hideToolbar
{ {
if ([NSDate timeIntervalSinceReferenceDate] - _timeSinceLastMouseMove >= 4) { self.cppPlugin->set_toolbar_visible(false);
self.cppPlugin->set_toolbar_visible(false); [NSCursor setHiddenUntilMouseMoves:YES];
[NSCursor setHiddenUntilMouseMoves:YES];
}
} }
@end @end
......
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