mirror of https://github.com/mpv-player/mpv
mac/input: define AltGr mask as static NSEvent.ModifierFlags variable
this makes it possible to properly test for those modifiers in a proper swift like way.
This commit is contained in:
parent
18fb71498b
commit
5482eecb8a
|
@ -85,8 +85,8 @@ class InputHelper: NSObject {
|
|||
if modifiers.contains(.command) {
|
||||
mask |= MP_KEY_MODIFIER_META
|
||||
}
|
||||
if modifiers.rawValue & UInt(NX_DEVICELALTKEYMASK) != 0 ||
|
||||
modifiers.rawValue & UInt(NX_DEVICERALTKEYMASK) != 0 && !mp_input_use_alt_gr(input)
|
||||
if modifiers.contains(.optionLeft) ||
|
||||
modifiers.contains(.optionRight) && !mp_input_use_alt_gr(input)
|
||||
{
|
||||
mask |= MP_KEY_MODIFIER_ALT
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
import Cocoa
|
||||
import IOKit.hidsystem
|
||||
|
||||
extension NSDeviceDescriptionKey {
|
||||
static let screenNumber = NSDeviceDescriptionKey("NSScreenNumber")
|
||||
|
@ -41,6 +42,11 @@ extension NSColor {
|
|||
}
|
||||
}
|
||||
|
||||
extension NSEvent.ModifierFlags {
|
||||
public static var optionLeft: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICELALTKEYMASK))
|
||||
public static var optionRight: NSEvent.ModifierFlags = .init(rawValue: UInt(NX_DEVICERALTKEYMASK))
|
||||
}
|
||||
|
||||
extension Bool {
|
||||
init(_ int32: Int32) {
|
||||
self.init(int32 != 0)
|
||||
|
|
Loading…
Reference in New Issue