summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-03-10 00:53:44 +0100
committerder richter <der.richter@gmx.de>2024-03-14 23:33:15 +0100
commit18fb71498be4a569f1c2ea99d897aa6bd1035202 (patch)
tree4e7a0dd1326b223ea93ea5001ccbec84fe92b189 /video
parent055e9cd93e96b4310618a25e990221d73f4efb03 (diff)
downloadmpv-18fb71498be4a569f1c2ea99d897aa6bd1035202.tar.bz2
mpv-18fb71498be4a569f1c2ea99d897aa6bd1035202.tar.xz
mac/events: remove redundant functions and optimise input helper usage
some redundant functions that jump through hoops.
Diffstat (limited to 'video')
-rw-r--r--video/out/mac/view.swift10
-rw-r--r--video/out/mac/window.swift2
2 files changed, 6 insertions, 6 deletions
diff --git a/video/out/mac/view.swift b/video/out/mac/view.swift
index 433284188c..ea4a715a28 100644
--- a/video/out/mac/view.swift
+++ b/video/out/mac/view.swift
@@ -53,7 +53,7 @@ class View: NSView, CALayerDelegate {
addTrackingArea(tracker!)
if containsMouseLocation() {
- cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_LEAVE, 0)
+ input?.putKey(SWIFT_KEY_MOUSE_LEAVE)
}
}
@@ -118,14 +118,14 @@ class View: NSView, CALayerDelegate {
override func mouseEntered(with event: NSEvent) {
if input?.mouseEnabled() ?? true {
- cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_ENTER, 0)
+ input?.putKey(SWIFT_KEY_MOUSE_ENTER)
}
common.updateCursorVisibility()
}
override func mouseExited(with event: NSEvent) {
if input?.mouseEnabled() ?? true {
- cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_LEAVE, 0)
+ input?.putKey(SWIFT_KEY_MOUSE_LEAVE)
}
common.titleBar?.hide()
common.setCursorVisibility(true)
@@ -202,7 +202,7 @@ class View: NSView, CALayerDelegate {
func signalMouseEvent(_ event: NSEvent, _ state: UInt32) {
hasMouseDown = state == MP_KEY_STATE_DOWN
let mpkey = getMpvButton(event)
- cocoa_put_key_with_modifiers((mpkey | Int32(state)), Int32(event.modifierFlags.rawValue))
+ input?.putKey((mpkey | Int32(state)), modifiers: event.modifierFlags)
}
func signalMouseMovement(_ event: NSEvent) {
@@ -250,7 +250,7 @@ class View: NSView, CALayerDelegate {
mpkey = deltaX > 0 ? SWIFT_WHEEL_LEFT : SWIFT_WHEEL_RIGHT
}
- cocoa_put_key_with_modifiers(mpkey, Int32(modifiers.rawValue))
+ input?.putKey(mpkey, modifiers: modifiers)
}
}
diff --git a/video/out/mac/window.swift b/video/out/mac/window.swift
index 26c0a44d83..59b9098af0 100644
--- a/video/out/mac/window.swift
+++ b/video/out/mac/window.swift
@@ -556,7 +556,7 @@ class Window: NSWindow, NSWindowDelegate {
}
func windowShouldClose(_ sender: NSWindow) -> Bool {
- cocoa_put_key(MP_KEY_CLOSE_WIN)
+ input?.putKey(MP_KEY_CLOSE_WIN)
return false
}