Page 1 of 1

How to call CGEventSource.secondsSinceLastEventType

Posted: Wed Aug 28, 2019 5:07 am
by Rinzwind
Any mac guru knows how to translate this piece to PB?

; var lastEvent:CFTimeInterval = 0
; lastEvent = CGEventSource.secondsSinceLastEventType(CGEventSourceStateID.hidSystemState, eventType: CGEventType(rawValue: ~0)!)

AFAIK:
hidSystemState is a constant with value 1. That ~0 matches kCGAnyInputEventType.
secondsSinceLastEventType is a class method. Can't find an example of calling one.

Any help appreciated.

Re: How to call CGEventSource.secondsSinceLastEventType

Posted: Wed Aug 28, 2019 5:37 am
by Rinzwind
Ah, so I should look at ObjectiveC source samples instead of Swift...

ImportC ""
CGEventSourceSecondsSinceLastEventType.d(CGEventSourceStateID.l, CGEventType.l)
EndImport

Solved for now.