summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2020-02-01 13:02:58 +0100
committerder richter <der.richter@gmx.de>2020-02-08 10:56:11 +0100
commit3ad9c32a5fabdfb1ca0a8e5766704042dfa995e6 (patch)
tree7f8da49210bb325dd21c398a8f756c42889d3d99 /video/out/cocoa-cb
parent2607a2b892ce3c4f4da0b09c88ed1d6a4951020c (diff)
downloadmpv-3ad9c32a5fabdfb1ca0a8e5766704042dfa995e6.tar.bz2
mpv-3ad9c32a5fabdfb1ca0a8e5766704042dfa995e6.tar.xz
cocoa-cb: simplify cursor hiding and make it less greedy
for reasons unknown to me the NSCursor (un)hide functions can be completely unreliable and the cursor can have an unknown state. this only happens on some system and wasn't able to reproduce this. it's probably some dumb race condition that might be possible to work around, though because of the lack of reproducibility on my end it's hard to test. i decided to rework the cursor hiding code yet again and make it a lot less greedy. the cursor will now always unhide when moved and there will never be a situation again the cursor can't be unhidden again. on the other hand there might be edge cases now where the cursor won't hide immediately and you have to move it slightly to make it disappear again. this should be an acceptable tradeoff. Fixes #6886
Diffstat (limited to 'video/out/cocoa-cb')
-rw-r--r--video/out/cocoa-cb/events_view.swift2
-rw-r--r--video/out/cocoa-cb/window.swift5
2 files changed, 5 insertions, 2 deletions
diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift
index 124a7a028d..296d447634 100644
--- a/video/out/cocoa-cb/events_view.swift
+++ b/video/out/cocoa-cb/events_view.swift
@@ -120,6 +120,7 @@ class EventsView: NSView {
if mpv?.mouseEnabled() ?? true {
cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_ENTER, 0)
}
+ cocoaCB.updateCursorVisibility()
}
override func mouseExited(with event: NSEvent) {
@@ -127,6 +128,7 @@ class EventsView: NSView {
cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_LEAVE, 0)
}
cocoaCB.titleBar?.hide()
+ cocoaCB.setCursorVisiblility(true)
}
override func mouseMoved(with event: NSEvent) {
diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift
index 2dbac9751d..ce7947cb90 100644
--- a/video/out/cocoa-cb/window.swift
+++ b/video/out/cocoa-cb/window.swift
@@ -183,7 +183,7 @@ class Window: NSWindow, NSWindowDelegate {
func windowDidEnterFullScreen(_ notification: Notification) {
isInFullscreen = true
cocoaCB.mpv?.setConfigProperty(fullscreen: isInFullscreen)
- cocoaCB.updateCusorVisibility()
+ cocoaCB.updateCursorVisibility()
endAnimation(frame)
cocoaCB.titleBar?.show()
}
@@ -517,12 +517,13 @@ class Window: NSWindow, NSWindowDelegate {
}
func windowDidBecomeKey(_ notification: Notification) {
- cocoaCB.updateCusorVisibility()
+ cocoaCB.updateCursorVisibility()
}
func windowDidChangeOcclusionState(_ notification: Notification) {
if occlusionState.contains(.visible) {
cocoaCB.layer?.update(force: true)
+ cocoaCB.updateCursorVisibility()
}
}