Closed Bug 951023 Opened 11 years ago Closed 11 years ago

Gonk widget should set modifier state at dispatching events derived from WidgetInputEvent

Categories

(Core Graveyard :: Widget: Gonk, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla29

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file, 1 obsolete file)

Similar to bug 951021, Gonk widget should set modifier state as far as possible.
Attached patch Patch (obsolete) — Splinter Review
I don't test this because I don't have devices which run FxOS. This patch is similar to bug 951021's patch, therefore, I guess this work well. tryserver build: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=7258700fd945
Attachment #8348508 - Flags: review?(mwu)
Comment on attachment 8348508 [details] [diff] [review] Patch >+ event.modifiers = mData.DOMModifiers(); >+ // When dispatching keypress event should cause text input, Alt, Ctrl and >+ // Meta states must not be set. >+ // XXX According to Android 4.4's behavior, we might not need to do this. >+ if (aEventMessage == NS_KEY_PRESS && >+ event.charCode && mChar != mUnmodifiedChar) { >+ event.modifiers &= ~(MODIFIER_ALT | MODIFIER_CONTROL | MODIFIER_META); >+ } According to nchen's comment at bug 951021 comment 3, this hack isn't necessary on Gonk.
Comment on attachment 8348508 [details] [diff] [review] Patch Review of attachment 8348508 [details] [diff] [review]: ----------------------------------------------------------------- Mostly makes sense, though we should probably test this before landing. ::: widget/gonk/nsAppShell.cpp @@ +288,3 @@ > PRUnichar PrintableKeyValue() const; > > + int32_t UnModifiedMetaState() const nit: UnmodifiedMetaState() looks better to me. @@ +313,2 @@ > > + if (mKeyCharMap.get()) { if (!mKeyCharMap.get()) return; Just have to make sure mChar and mUnmodifiedChar are initialized to some value. @@ +314,5 @@ > + if (mKeyCharMap.get()) { > + mChar = mKeyCharMap->getCharacter(mData.key.keyCode, mData.metaState); > + if (mChar < ' ') { > + mChar = 0; > + } Odd indentation @@ +338,3 @@ > return 0; > } > + if (mChar >= ' ') { Due to the logic in the KeyEventDispatcher constructor, I think we can just do return mChar ? mChar : mUnmodifiedChar;
Attachment #8348508 - Flags: review?(mwu)
Attached patch PatchSplinter Review
Sorry, I forgot to post this new patch. Changes from the previous patch: * Removing the code of adjusting modifiers for printable keys because I guess it is not necessary on Android 4.x. See comment 3. * Adding IsControlChar() instead of comparing with ASCII whitespace. * Removing CharCode() because mChar now stores it.
Attachment #8348508 - Attachment is obsolete: true
Attachment #8356060 - Flags: review?(mwu)
Comment on attachment 8356060 [details] [diff] [review] Patch Looks good. If you haven't tested this on a device though, I'll try to test it on a device some time this week.
Attachment #8356060 - Flags: review?(mwu) → review+
(In reply to Michael Wu [:mwu] from comment #6) > Comment on attachment 8356060 [details] [diff] [review] > Patch > > Looks good. If you haven't tested this on a device though, I'll try to test > it on a device some time this week. Yes, I've not tested the patch. I'd like you to test it. Do you want to test it before landing? Or you will test it on landed build and file followup bugs?
I'll test it before landing, and then mark check-in needed if things look ok.
Okay, thank you for your testing!
WFM
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: