Closed
Bug 619519
Opened 14 years ago
Closed 14 years ago
Fix android key down/press/up handling
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(fennec2.0b4+)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fennec | 2.0b4+ | --- |
People
(Reporter: mwu, Assigned: mwu)
References
Details
Attachments
(1 file, 3 obsolete files)
5.09 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•14 years ago
|
tracking-fennec: --- → ?
Comment 1•14 years ago
|
||
I think that nsWindow::InitKeyEvent() shouldn't set charCode if the event is NS_KEY_DOWN or NS_KEY_UP. And if the event is NS_KEY_PRESS and it has charCode, should clear the keyCode.
Comment 2•14 years ago
|
||
I meant that we shouldn't fix this bug by changing nsWindow::OnKeyEvent().
Assignee | ||
Comment 3•14 years ago
|
||
Attachment #498172 -
Flags: review?(masayuki)
Comment 4•14 years ago
|
||
Comment on attachment 498172 [details] [diff] [review] Improve key event handling on android + nsEventStatus status; nsKeyEvent event(PR_TRUE, msg, this); InitKeyEvent(event, *ae); - DispatchEvent(&event); + DispatchEvent(&event, status); - if (isDown) { + if (isDown && status != nsEventStatus_eConsumeNoDefault) { nsKeyEvent pressEvent(PR_TRUE, NS_KEY_PRESS, this); This is wrong. Even if the keydown event was consumed and shouldn't do default, we must dispatch the event. But you need to set NS_EVENT_FLAG_NO_DEFAULT flag to the keypress event's flags. See gtk2 implementation: http://mxr.mozilla.org/mozilla-central/source/widget/src/gtk2/nsWindow.cpp#3067 However, there is another rule. You must not dispatch keypress event if the down key is a modifier key such as Ctrl, Alt, Meta or Shift key. I think that InitKeyEvent() should return PRBool if the event shouldn't be dispatched. Then, the OnKeyEvent() will not be complicated.
Assignee | ||
Comment 5•14 years ago
|
||
Attachment #498172 -
Attachment is obsolete: true
Attachment #498235 -
Flags: review?(masayuki)
Attachment #498172 -
Flags: review?(masayuki)
Comment 6•14 years ago
|
||
Comment on attachment 498235 [details] [diff] [review] Improve key event handling on android, v2 Can we use MotionEvent.getMetaState()? http://developer.android.com/reference/android/view/MotionEvent.html#getMetaState%28%29 Looks like we don't copy it for MotionEvent. http://mxr.mozilla.org/mozilla-central/source/widget/src/android/AndroidJavaWrappers.cpp#297
Assignee | ||
Comment 7•14 years ago
|
||
Looks like android does provide proper alt/shift key state reporting after all. I missed that somehow - thanks for pointing that out. This patch also filters out ascii control characters that android might send. Only setting \n in charCode without setting keyCode breaks our fennec frontend. \n might be the only control code that android tries to send, but a bunch of them are filtered out just in case.
Attachment #498235 -
Attachment is obsolete: true
Attachment #498437 -
Flags: review?(masayuki)
Attachment #498235 -
Flags: review?(masayuki)
Assignee | ||
Comment 8•14 years ago
|
||
Also note that the simple gestures don't get shift and alt set correctly, but that's fine as we're currently planning to remove those events completely.
Comment 9•14 years ago
|
||
Comment on attachment 498437 [details] [diff] [review] Improve key event handling on android, v3 great! thanks!
Attachment #498437 -
Flags: review?(masayuki) → review+
Assignee | ||
Comment 10•14 years ago
|
||
Comment on attachment 498437 [details] [diff] [review] Improve key event handling on android, v3 Requesting approval for a patch which will give us key event handling parity with other widget backends.
Attachment #498437 -
Flags: approval2.0?
Comment 11•14 years ago
|
||
Comment on attachment 498437 [details] [diff] [review] Improve key event handling on android, v3 Can't give approval without some kind of tests. Once our Android testing system gets off the ground we can start that process. But since this could fix a blocker, we can make it a blocker.
Attachment #498437 -
Flags: approval2.0?
Updated•14 years ago
|
tracking-fennec: ? → 2.0b4+
Assignee | ||
Comment 12•14 years ago
|
||
Attachment #498437 -
Attachment is obsolete: true
Updated•14 years ago
|
Keywords: checkin-needed
Comment 13•14 years ago
|
||
Pushed: http://hg.mozilla.org/mozilla-central/rev/a2a3a6e8b0e0
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Keywords: checkin-needed
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•