[vlc-commits] macosx: Only hide mouse if inside the video view

Marvin Scholz git at videolan.org
Tue Sep 26 15:16:31 CEST 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Sep 26 15:14:13 2017 +0200| [e418e3fa1a9f2a8f0d0d15c25525dfaaf99e6c86] | committer: Marvin Scholz

macosx: Only hide mouse if inside the video view

Ref #18658

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e418e3fa1a9f2a8f0d0d15c25525dfaaf99e6c86
---

 modules/gui/macosx/VLCVoutWindowController.h |  2 ++
 modules/gui/macosx/VLCVoutWindowController.m | 21 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.h b/modules/gui/macosx/VLCVoutWindowController.h
index 8959e2860b..d144708eab 100644
--- a/modules/gui/macosx/VLCVoutWindowController.h
+++ b/modules/gui/macosx/VLCVoutWindowController.h
@@ -46,4 +46,6 @@
 
 - (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
 
+- (void)hideMouseForWindow:(vout_window_t *)p_wnd;
+
 @end
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 3ac2afdc8c..5e2a756fd3 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -145,7 +145,7 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
             }
             case VOUT_WINDOW_HIDE_MOUSE:
             {
-                [NSCursor setHiddenUntilMouseMoves:YES];
+                [voutController hideMouseForWindow:p_wnd];
                 break;
             }
             default:
@@ -216,6 +216,25 @@ void WindowClose(vout_window_t *p_wnd)
 }
 
 #pragma mark -
+#pragma mark Mouse hiding
+
+- (void)hideMouseForWindow:(vout_window_t *)p_wnd
+{
+    VLCVideoWindowCommon *o_current_window = nil;
+    if (p_wnd)
+        o_current_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
+    
+    if (o_current_window == nil)
+        return;
+    
+    if (NSPointInRect([o_current_window mouseLocationOutsideOfEventStream],
+                      [[o_current_window videoView] convertRect:[[o_current_window videoView] bounds]
+                                                         toView:nil])) {
+        [NSCursor setHiddenUntilMouseMoves:YES];
+    }
+}
+
+#pragma mark -
 #pragma mark Methods for vout provider
 
 - (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition



More information about the vlc-commits mailing list