[vlc-commits] windowed mac plugin: hide toolbar after 4 secs of mouse inactivity
Felix Paul Kühne
git at videolan.org
Wed Jan 16 15:02:06 CET 2013
npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jan 16 15:02:02 2013 +0100| [015cca915aa7bab35ab3bb0bca98ff6e9c354af5] | committer: Felix Paul Kühne
windowed mac plugin: hide toolbar after 4 secs of mouse inactivity
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=015cca915aa7bab35ab3bb0bca98ff6e9c354af5
---
npapi/vlcplugin_mac.mm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index d24c1e3..b1ea9fb 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -88,6 +88,7 @@
@interface VLCFullscreenContentView : NSView {
VlcPluginMac *_cppPlugin;
+ NSTimeInterval _timeSinceLastMouseMove;
}
@property (readwrite) VlcPluginMac * cppPlugin;
@@ -984,9 +985,19 @@ static CGImageRef createImageNamed(NSString *name)
- (void)mouseMoved:(NSEvent *)theEvent
{
self.cppPlugin->set_toolbar_visible(true);
+ _timeSinceLastMouseMove = [NSDate timeIntervalSinceReferenceDate];
+ [self performSelector:@selector(hideToolbar) withObject:nil afterDelay: 4.1];
[super mouseMoved: theEvent];
}
+- (void)hideToolbar
+{
+ if ([NSDate timeIntervalSinceReferenceDate] - _timeSinceLastMouseMove >= 4) {
+ self.cppPlugin->set_toolbar_visible(false);
+ [NSCursor setHiddenUntilMouseMoves:YES];
+ }
+}
+
@end
More information about the vlc-commits
mailing list