On 09/04/2013 09:43 AM, Kan-Ru Chen (陳侃如) wrote:
Alive <[email protected]> writes:
Hi folks,
Story:
we had caught hardware key events in shell.js and prevent it to be
sent to user app(mozbrowser iframe) but only send alternative
mozChromeEvent to system app only.[1]
But we'd like the user app is able to catch the events! [2]
This is an old issue from long time ago,
and yesterday I tried to make a quick workaround patch to broadcast
those events via system message (and tells systems app do not launch
the app acquires hardware button events), but @:fabrice thinks this is
a hack ;)
Indeed a hack ;)
So if we're going to use DOM3 KeyboardEvents [3], we have some problems needs
to resolve:
* Gonk is mapping volumeup key/volumedown key to pageup/pagedown now.
With this we couldn't tell user app to use |evt.key =
KeyboardEvent.DOM_VK_PAGE_UP| instead of DOM_VK_VOLUME_UP.
@:mwu, any idea about this? This issue shall fall under gonk if I'm
not wrong.
We could change the mapping. With DOM3 KeyboardEvents those key should
have evt.key == 'VolumeDown' or 'VolumeUp'.
Indeed.
* What if the user app do |preventDefault()| ?
Shall we allow this usage for volumeup/volumedown, even for home and sleep
button?
Could we 'prevent' the preventDefault() call in this case?
@:smaug, could you please offer some opinion?
I think we should broaden the definition of the DOM event flow. The
event flows like 'B2G Chrome'-->'Window Manager (System app)'-->'Currently
focused app'
And we could define the default action of those events. System app could
catch the event even if the app tries to preventDefault it (if it's
cancelable)
So we'd want to propagate event back from focused app to chrome/system? That is
of course asynchronous, but should be ok.
We do have some support for that in
TabParent/TabChild/nsIFrameLoader.activateFrameEvent() and in DOM events (we
can serialize/deserialize certain
types of events), however I'm not aware that being used currently. Looks like
key events aren't supported currently, but
if this mechanism would be useful for b2g, adding ::Serialize/::Deserialize to
nsDOMKeyboardEvent should be easy.
-Olli
Kanru
* Gecko has a whitelist of events could pass the mozbrowser
iframe. [3] But now if there's a non-mozbrowser iframe falls under a
mozbrowser iframe, the events couldn't pass to the parent frame. This
needs some fix.
Any help is appreciated, thanks!!
--
[1] See https://bugzilla.mozilla.org/show_bug.cgi?id=762362.
[2] See https://bugzilla.mozilla.org/show_bug.cgi?id=820706.
[3] See https://bugzilla.mozilla.org/show_bug.cgi?id=842927.
[4] See https://bugzilla.mozilla.org/show_bug.cgi?id=757486.
--
Alive C. Kuo, Front-end Engineer, FirefoxOS, MoCo. Taiwan, Taipei office.
[email protected]
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g