2010/9/12 Dave Zarzycki
<zarzycki@apple.com>
On Sep 8, 2010, at 8:42 PM, cee1 wrote:
2. We have custom source of type DISPATCH_SOURCE_TYPE_DATA_ADD and DISPATCH_SOURCE_TYPE_DATA_OR, and can use dispatch_source_merge_data
to fire custom sources. Why we don't have an 'is_level' source?
An "is_level" source may not make much sense, but can be attached with cancel handler, this may be useful in some cases.
If you can think of a practical use for that, then let us know.
I find a case, it's about adding T9 physical keyboard support on Android.
We found some input methods already support T9 virtual keyboard but not physical one. So we handle onKeyDown event, translating a physical key press to a touch event on the virtual keyboard, e.g:
key '2' -> touchEvent (10, 20) -- (10, 20) is (x,y) in screen coordinates.
Unfortunately synthesizing and sending a touch event will spend some time, causing android prompts not responsible of this program. So synthesizing and sending a touch event should be delayed to another thread. This time, 'is_level' custom source will be useful:
ds = dispatch_source_create(DISPATCH_SOURCE_TYPE_DATA_LEVEL, ...);