Event loop expiration date insight
Event loop expiration date insight
- Subject: Event loop expiration date insight
- From: Graham Cox <email@hidden>
- Date: Wed, 31 Oct 2012 15:58:45 +1100
I'm handling some mouse dragging tasks modally by implementing my own modal event loop using [NSApp nextEventMatchingMask:untilDate:inMode:dequeue:].
I'm wondering what is the usual correct thing to pass for the 'untilDate' parameter. For a long time I've been using [NSDate distantFuture], but the documentation of this method says that by passing nil it uses [NSDate distantPast], which implies perhaps that this is a more usual default. In thinking about this I realise I don't really understand what this parameter is doing, especially when 'distantPast' is specified - does that mean do not wait at all for any events and only return one if it's already queued?
I've changed this to pass nil and my mouse dragging works as normal.
What set me looking at this is a strange report of this loop going screwy for one user, which I can't reproduce. According to the logs from that user, suddenly several 'mouseUp' events are delivered one after the other which seems impossible, and that confuses my code. Can anyone think of any reason why multiple mouseUps could be delivered (i'm passing YES for the dequeue parameter)? I'm wondering if a third-party extension could be interfering with events somehow - anyone heard of anything like that?
--Graham
_______________________________________________
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