isShiftPressedViaHid function

bool isShiftPressedViaHid()

The live Shift state from the HID system; false when CoreGraphics is unavailable. Call only after resolveHidShiftPressed gated the session — see the library docs.

Implementation

bool isShiftPressedViaHid() {
  final fn = _cgEventSourceFlagsState;
  if (fn == null) return false;
  const kCGEventSourceStateHIDSystemState = 1;
  const kCGEventFlagMaskShift = 0x00020000;
  return fn(kCGEventSourceStateHIDSystemState) & kCGEventFlagMaskShift != 0;
}