зеркало из https://github.com/mozilla/gecko-dev.git
Bug 462995 Cannot type 2 or more characters from software keyboard r=josh+smichaud, sr=roc, a=beltzner
This commit is contained in:
Родитель
404c7157ac
Коммит
20f6ae4515
|
@ -200,6 +200,7 @@ nsIWidget * gRollupWidget = nsnull;
|
|||
|
||||
- (void)fireKeyEventForFlagsChanged:(NSEvent*)theEvent keyDown:(BOOL)isKeyDown;
|
||||
|
||||
- (void)initTSMDocument;
|
||||
@end
|
||||
|
||||
|
||||
|
@ -5092,6 +5093,9 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
if (!mGeckoChild)
|
||||
return nsRect(0, 0, 0, 0);
|
||||
|
||||
if (aEventType == NS_COMPOSITION_START)
|
||||
[self initTSMDocument];
|
||||
|
||||
// static void init_composition_event( *aEvent, int aType)
|
||||
nsCompositionEvent event(PR_TRUE, aEventType, mGeckoChild);
|
||||
event.time = PR_IntervalNow();
|
||||
|
@ -5199,8 +5203,13 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
}
|
||||
}
|
||||
|
||||
mKeyPressHandled = mGeckoChild->DispatchWindowEvent(geckoEvent);
|
||||
mKeyPressSent = YES;
|
||||
PRBool keyPressHandled = mGeckoChild->DispatchWindowEvent(geckoEvent);
|
||||
// Only record the results of dispatching geckoEvent if we're currently
|
||||
// processing a keyDown event.
|
||||
if (mCurKeyEvent) {
|
||||
mKeyPressHandled = keyPressHandled;
|
||||
mKeyPressSent = YES;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!nsTSMManager::IsComposing()) {
|
||||
|
@ -5650,27 +5659,6 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf)
|
|||
}
|
||||
}
|
||||
|
||||
// We need to initialize the TSMDocument *before* interpretKeyEvents when
|
||||
// IME is enabled.
|
||||
if (!isKeyEquiv && nsTSMManager::IsIMEEnabled()) {
|
||||
// We need to get actual focused view. E.g., the view is in bookmark dialog
|
||||
// that is <panel> element. Then, the key events are processed the parent
|
||||
// window's view that has native focus.
|
||||
nsQueryContentEvent textContent(PR_TRUE, NS_QUERY_TEXT_CONTENT,
|
||||
mGeckoChild);
|
||||
textContent.InitForQueryTextContent(0, 0);
|
||||
mGeckoChild->DispatchWindowEvent(textContent);
|
||||
NSView<mozView>* focusedView = self;
|
||||
if (textContent.mSucceeded && textContent.mReply.mFocusedWidget) {
|
||||
NSView<mozView>* view =
|
||||
static_cast<NSView<mozView>*>(textContent.mReply.mFocusedWidget->
|
||||
GetNativeData(NS_NATIVE_WIDGET));
|
||||
if (view)
|
||||
focusedView = view;
|
||||
}
|
||||
nsTSMManager::InitTSMDocument(focusedView);
|
||||
}
|
||||
|
||||
// Let Cocoa interpret the key events, caching IsComposing first.
|
||||
// We don't do it if this came from performKeyEquivalent because
|
||||
// interpretKeyEvents isn't set up to handle those key combinations.
|
||||
|
@ -5720,6 +5708,29 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf)
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
|
||||
}
|
||||
|
||||
- (void)initTSMDocument
|
||||
{
|
||||
if (!mGeckoChild)
|
||||
return;
|
||||
|
||||
// We need to get actual focused view. E.g., the view is in bookmark dialog
|
||||
// that is <panel> element. Then, the key events are processed the parent
|
||||
// window's view that has native focus.
|
||||
nsQueryContentEvent textContent(PR_TRUE, NS_QUERY_TEXT_CONTENT,
|
||||
mGeckoChild);
|
||||
textContent.InitForQueryTextContent(0, 0);
|
||||
mGeckoChild->DispatchWindowEvent(textContent);
|
||||
NSView<mozView>* focusedView = self;
|
||||
if (textContent.mSucceeded && textContent.mReply.mFocusedWidget) {
|
||||
NSView<mozView>* view =
|
||||
static_cast<NSView<mozView>*>(textContent.mReply.mFocusedWidget->
|
||||
GetNativeData(NS_NATIVE_WIDGET));
|
||||
if (view)
|
||||
focusedView = view;
|
||||
}
|
||||
nsTSMManager::InitTSMDocument(focusedView);
|
||||
}
|
||||
|
||||
|
||||
// Create a TSM document for use with plugins, so that we can support IME in
|
||||
// them. Once it's created, if need be (re)activate it. Some plugins (e.g.
|
||||
|
|
Загрузка…
Ссылка в новой задаче