summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-02-10 15:33:01 +0100
committerAkemi <der.richter@gmx.de>2017-02-16 22:22:11 +0100
commit9ac05a575ce6cffa679c79b6539a798a2d41efde (patch)
treeec61dbb6bfa09539c7b93868a5b0f4cd28878386 /video/out/cocoa
parenta5b97104cff358beebdb7ed1e96f7ab441295afa (diff)
downloadmpv-9ac05a575ce6cffa679c79b6539a798a2d41efde.tar.bz2
mpv-9ac05a575ce6cffa679c79b6539a798a2d41efde.tar.xz
cocoa: refactor mouse events and cursor visibility
we reported some unnecessary mouse movements and not all mouse enter and leave events. that lead to wrongly reported activity on hover areas like on the OSC or comparable lua scripts. sometimes menu items were shown that shouldn't be shown or they didn't vanish because of the missing mouse leave event. this incorporates @torque's fix for mouse leave events that weren't triggered during a transition, like going to fullscreen. the tracking area was updated but the mouse never left that area because it was never over it. besides some known cursor visibility bugs the aforementioned changes also revealed some other bugs that weren't reproducible before because of the missbehavior. known issues, in some cases the cursor doesn't show or hide properly. for example when switching spaces, switching Apps via CMD+Tab or a system notification. former two could be fixed while keeping our current blank cursor approach. though the notification case couldn't. there is no event or similar to detect a notification and the cursor visibility couldn't be recovered in any way. new issues, i noticed that our event view isn't initialised yet when the first VOCTRL_SET_CURSOR_VISIBILITY event gets dispatched, which depends on the event view to be initialised. so the mouse cursor couldn't be hidden when mpv was opened and the cursor was within the window bounds. this wasn't noticeable before because of various bugs and unwanted behavior that have been fixed with this. now, in case the event view isn't ready yet, we set the visibility at a later point when the event view is ready and a helper flag is set. Fixes #1817 #3856 #4147
Diffstat (limited to 'video/out/cocoa')
-rw-r--r--video/out/cocoa/events_view.h1
-rw-r--r--video/out/cocoa/events_view.m13
-rw-r--r--video/out/cocoa/mpvadapter.h1
3 files changed, 3 insertions, 12 deletions
diff --git a/video/out/cocoa/events_view.h b/video/out/cocoa/events_view.h
index 6ad51cc133..91a6289be8 100644
--- a/video/out/cocoa/events_view.h
+++ b/video/out/cocoa/events_view.h
@@ -21,5 +21,4 @@
@interface MpvEventsView : NSView <NSDraggingDestination>
@property(nonatomic, retain) MpvCocoaAdapter *adapter;
- (BOOL)canHideCursor;
-- (void)signalMousePosition;
@end
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m
index f76ca0d617..d91c68046b 100644
--- a/video/out/cocoa/events_view.m
+++ b/video/out/cocoa/events_view.m
@@ -74,6 +74,9 @@
userInfo:nil] autorelease];
[self addTrackingArea:self.tracker];
+
+ if (![self containsMouseLocation])
+ [self.adapter putKey:MP_KEY_MOUSE_LEAVE withModifiers:0];
}
- (NSPoint)mouseLocation
@@ -148,8 +151,6 @@
if (self.clearing)
return;
-
- [self signalMousePosition];
}
- (NSPoint)convertPointToPixels:(NSPoint)point
@@ -162,14 +163,6 @@
return point;
}
-- (void)signalMousePosition
-{
- NSPoint p = [self convertPointToPixels:[self mouseLocation]];
- p.x = MIN(MAX(p.x, 0), self.bounds.size.width-1);
- p.y = MIN(MAX(p.y, 0), self.bounds.size.height-1);
- [self.adapter signalMouseMovement:p];
-}
-
- (void)signalMouseMovement:(NSEvent *)event
{
NSPoint p = [self convertPointToPixels:[event locationInWindow]];
diff --git a/video/out/cocoa/mpvadapter.h b/video/out/cocoa/mpvadapter.h
index e547708e17..65832aeae5 100644
--- a/video/out/cocoa/mpvadapter.h
+++ b/video/out/cocoa/mpvadapter.h
@@ -28,7 +28,6 @@
- (void)handleFilesArray:(NSArray *)files;
- (void)didChangeWindowedScreenProfile:(NSNotification *)notification;
- (void)performAsyncResize:(NSSize)size;
-- (void)didChangeMousePosition;
- (BOOL)isInFullScreenMode;
- (BOOL)keyboardEnabled;