Re: NSEvent timestamp is zero
Re: NSEvent timestamp is zero
n 7 Jan 2010, at 03:31, Rob Keniger wrote:
>
> On 07/01/2010, at 10:47 AM, email@hidden wrote:
>
>> I am trying to filter my NSEvents by timestamp but some, with event type of NSAppKItDefined, have a zero timestamp.
>>
>> I can work around this by calculating a timestamp value for the event as the current time since system boot.
>>
>> Is a mach timer the way to go on this?
>
>
> What are you actually trying to do? Why do you need to filter the events by timestamp?
>
1. I have an NSButton that toggles an operation between active and suspended.
2. At some point the operation completes and I process the results of the operation.
3. The user can still toggle the operation for the few seconds that the result is being processed.
I wish to discard the NSButton action triggering events that occur while the results are processed to stop a further operation from being initiated.
Once the operation is done and processed I don't want to respond to any previous mouse click events that remain in the event queue for that button.
Filtering on the timestamp seemed like the way to go.
It seems curious that there is no message such as [NSEvent currentTimestamp] as the timestamp is required by most of the NSEvent factor methods.
Probably explains why the app kit generated event has a zero timestamp.
sysctl doesn't seem to offer the system up time, just kernel boot time (corrections welcome).
I did some brief examination of using a mach clock timer but I might be on completely the wrong track.
There might be other ways of achieving my desired behaviour but the event filter is appealing.
Thanks
jonathan_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden