Files
sst/Sources/SstCore/ModifierKeyTracker.swift
2026-10-01 14:58:31 +02:00

13 lines
390 B
Swift

public struct ModifierKeyTracker {
private var isDown = false
public init() {}
/// Feed the current state of the bound modifier flag; returns an event only on a transition.
public mutating func process(isDown: Bool) -> HotkeyEvent? {
guard isDown != self.isDown else { return nil }
self.isDown = isDown
return isDown ? .pressed : .released
}
}