Re: Flushing events
Re: Flushing events
- Subject: Re: Flushing events
- From: Ricky Sharp <email@hidden>
- Date: Fri, 4 Nov 2005 11:08:46 -0600
On Nov 3, 2005, at 5:38 PM, Ricky Sharp wrote:
On Nov 2, 2005, at 7:02 PM, Ricky Sharp wrote:
I have a need to flush all events before entering a local event
loop. I've search for a 'flushEvents' API, but can't come up with
any. The article at <http://www.cocoadev.com/index.pl?
FlushAppEventQueue> didn't help much either.
I've seen discardEventsMatchingMask:beforeEvent:, but what I
really need is a discardEventsMatchingMask:afterEvent:
Before I enter the local loop, I've thought of capturing the
current timestamp and "eating" events that occurred before that
time via the nextEventMatchingMask APIs.
In an off-post thread, someone made the suggestion to use the Carbon
flush event APIs since Cocoa events live on top of that system. That
failed as well leading me to believe that I'm flushing after the
point where the Carbon events are turned into Cocoa events.
Anyhow, I decided to log the events to see exactly what happens with
a double-click:
2005-11-03 19:49:29.124 theEvent = NSEvent: type=LMouseDown loc=
(789,281) time=54416.1 flags=0x100 win=0 winNum=13247 ctxt=0x985f
evNum=6410 click=1 buttonNumber=0 pressure=1
2005-11-03 19:49:29.310 theEvent = NSEvent: type=SysDefined loc=
(1237,497) time=54416.2 flags=0x100 win=0 winNum=0 ctxt=0x985f
subtype=7 data1=1 data2=1
2005-11-03 19:49:29.310 theEvent = NSEvent: type=LMouseDown loc=
(789,281) time=54416.2 flags=0x100 win=0 winNum=13247 ctxt=0x985f
evNum=6411 click=2 buttonNumber=0 pressure=1
You can see that there are actually two mousedown events at play
here. I think the problem I'm ultimately having is due to the fact
that both my main screen and "dialog" are in the same window (winNum
is identical in both events). Perhaps my kiosk-type app is doing
things that just doesn't fit well into this design.
I could rewrite some of my mouseDown code in my custom button control
to completely ignore any mousedown with click counts above 1. If
that fails, I'll still look into a working flushevents solution.
A potential solution could be to use a floating window (or at least a
window at a higher layer) to hold my virtual dialogs. The theory is
that by the time the second mousedown event is dispatched, the key
window would be different. As to what will exactly happen to that
event, I do not know. My guess is that it would be discarded. That
would provide me the same net result as if I was able to flush such
events.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden