13 lines
355 B
Swift
13 lines
355 B
Swift
public struct FnKeyTracker {
|
|
private var isDown = false
|
|
|
|
public init() {}
|
|
|
|
/// Feed the current Fn flag state; returns an event only on a transition.
|
|
public mutating func process(fnDown: Bool) -> HotkeyEvent? {
|
|
guard fnDown != isDown else { return nil }
|
|
isDown = fnDown
|
|
return fnDown ? .pressed : .released
|
|
}
|
|
}
|