mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
cocoa: fix mouse hiding with launchpad and dock folders
Some UI elements in OS X – like Launchpad and Dock folders – are implemented using borderless windows in background demonized applications. When we use these elements, mpv doesn't stop to be the active application, but the mpv window leaves keyWindow state while we use the OS controls. This commit just keeps track of window state to update the cursor visibility accordingly. Fixes #513
This commit is contained in:
parent
6172e843cd
commit
ce239f1577
@ -28,6 +28,7 @@
|
||||
- (void)handleFilesArray:(NSArray *)files;
|
||||
- (void)didChangeWindowedScreenProfile:(NSScreen *)screen;
|
||||
- (void)performAsyncResize:(NSSize)size;
|
||||
- (void)didChangeMousePosition;
|
||||
|
||||
- (BOOL)isInFullScreenMode;
|
||||
- (BOOL)keyboardEnabled;
|
||||
|
@ -61,6 +61,16 @@
|
||||
[self.adapter didChangeWindowedScreenProfile:[self screen]];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
[self.adapter didChangeMousePosition];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
[self.adapter didChangeMousePosition];
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
|
@ -258,7 +258,7 @@ static int vo_cocoa_set_cursor_visibility(struct vo *vo, bool *visible)
|
||||
|
||||
if (*visible) {
|
||||
CGDisplayShowCursor(kCGDirectMainDisplay);
|
||||
} else if ([v canHideCursor]) {
|
||||
} else if ([v canHideCursor] && [s->window isKeyWindow]) {
|
||||
CGDisplayHideCursor(kCGDirectMainDisplay);
|
||||
} else {
|
||||
*visible = true;
|
||||
@ -847,4 +847,10 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
struct vo_cocoa_state *s = self.vout->cocoa;
|
||||
s->pending_events |= VO_EVENT_ICC_PROFILE_CHANGED;
|
||||
}
|
||||
|
||||
- (void)didChangeMousePosition
|
||||
{
|
||||
struct vo_cocoa_state *s = self.vout->cocoa;
|
||||
[(MpvEventsView *)s->view signalMousePosition];
|
||||
}
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user