Bug 808287 - Use counter instead of boolean to mask events after focus change; r=cpeterson

This commit is contained in:
Jim Chen 2012-11-16 11:41:54 -05:00
parent ad6de44c12
commit f64bbf94d5
2 changed files with 6 additions and 5 deletions

View File

@ -164,7 +164,7 @@ nsWindow::nsWindow() :
mIMEComposing(false),
mIMEMaskSelectionUpdate(false),
mIMEMaskTextUpdate(false),
mIMEMaskEvents(true) // Mask IME events since there's no focus yet
mIMEMaskEventsCount(1) // Mask IME events since there's no focus yet
{
}
@ -1883,10 +1883,11 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
nsRefPtr<nsWindow> kungFuDeathGrip(this);
if (ae->Action() == AndroidGeckoEvent::IME_ACKNOWLEDGE_FOCUS) {
mIMEMaskEvents = false;
MOZ_ASSERT(mIMEMaskEventsCount > 0);
mIMEMaskEventsCount--;
return;
}
if (mIMEMaskEvents) {
if (mIMEMaskEventsCount > 0) {
// Still reply to events, but don't do anything else
if (ae->Action() == AndroidGeckoEvent::IME_SYNCHRONIZE ||
ae->Action() == AndroidGeckoEvent::IME_REPLACE_TEXT) {
@ -2184,7 +2185,7 @@ nsWindow::OnIMEFocusChange(bool aFocus)
// Mask events because we lost focus. On the next focus event, Gecko will notify
// Java, and Java will send an acknowledge focus event back to Gecko. That is
// where we unmask event handling
mIMEMaskEvents = true;
mIMEMaskEventsCount++;
}
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_FOCUSCHANGE,

View File

@ -184,7 +184,7 @@ protected:
bool mIMEComposing;
bool mIMEMaskSelectionUpdate, mIMEMaskTextUpdate;
bool mIMEMaskEvents;
int32_t mIMEMaskEventsCount; // Mask events when > 0
nsString mIMEComposingText;
nsAutoTArray<nsTextRange, 4> mIMERanges;