[vlc-commits] macosx: Use window mouse hide event instead of own timer
Marvin Scholz
git at videolan.org
Tue Sep 26 15:16:19 CEST 2017
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Sep 26 14:35:42 2017 +0200| [b00d2da193c9465e8100a9df47291c12f5a3ece3] | committer: Marvin Scholz
macosx: Use window mouse hide event instead of own timer
Instead of a custom timer, use the window mouse hide event that the
core sends.
Ref #18658
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b00d2da193c9465e8100a9df47291c12f5a3ece3
---
modules/gui/macosx/VLCVoutWindowController.m | 5 +++
modules/gui/macosx/Windows.m | 47 ----------------------------
2 files changed, 5 insertions(+), 47 deletions(-)
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 9b086c8f60..3ac2afdc8c 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -143,6 +143,11 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
break;
}
+ case VOUT_WINDOW_HIDE_MOUSE:
+ {
+ [NSCursor setHiddenUntilMouseMoves:YES];
+ break;
+ }
default:
{
msg_Warn(p_wnd, "unsupported control query: %i", i_query );
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 8a02532fe9..08b30b4b41 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -215,8 +215,6 @@
BOOL b_video_view_was_hidden;
- NSTimer *t_hide_mouse_timer;
-
NSRect frameBeforeLionFullscreen;
}
@@ -542,46 +540,6 @@
}
#pragma mark -
-#pragma mark Mouse cursor handling
-
-// NSTimer selectors require this function signature as per Apple's docs
-- (void)hideMouseCursor:(NSTimer *)timer
-{
- [NSCursor setHiddenUntilMouseMoves: YES];
-}
-
-- (void)recreateHideMouseTimer
-{
- if (t_hide_mouse_timer != nil) {
- [t_hide_mouse_timer invalidate];
- }
-
- t_hide_mouse_timer = [NSTimer scheduledTimerWithTimeInterval:2
- target:self
- selector:@selector(hideMouseCursor:)
- userInfo:nil
- repeats:NO];
-}
-
-// Called automatically if window's acceptsMouseMovedEvents property is true
-- (void)mouseMoved:(NSEvent *)theEvent
-{
- if (self.fullscreen)
- [self recreateHideMouseTimer];
- if (self.hasActiveVideo && [self isKeyWindow]) {
- if (NSPointInRect([theEvent locationInWindow],
- [[self videoView] convertRect:[[self videoView] bounds]
- toView:nil])) {
- [self recreateHideMouseTimer];
- } else {
- [t_hide_mouse_timer invalidate];
- }
- }
-
- [super mouseMoved: theEvent];
-}
-
-#pragma mark -
#pragma mark Key events
- (void)flagsChanged:(NSEvent *)theEvent
@@ -691,9 +649,6 @@
}
}
- if ([self hasActiveVideo])
- [[[VLCMain sharedInstance] mainWindow] recreateHideMouseTimer];
-
if (_darkInterface) {
[self.titlebarView setHidden:YES];
self.videoViewTopConstraint.priority = 1;
@@ -808,8 +763,6 @@
[self.controlsBar setFullscreenState:YES];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] setFullscreenState:YES];
- [[[VLCMain sharedInstance] mainWindow] recreateHideMouseTimer];
-
if (blackout_other_displays)
[screen blackoutOtherScreens];
More information about the vlc-commits
mailing list