mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 417315 Cannot use IME menus during IME transaction #1 r=josh+roc, sr=roc, a1.9=beltzner
This commit is contained in:
parent
2f230818c7
commit
2b676caa55
@ -179,15 +179,6 @@ nsIMEStateManager::OnDeactivate(nsPresContext* aPresContext)
|
||||
return NS_OK;
|
||||
|
||||
sActiveWindow = nsnull;
|
||||
#ifdef NS_KBSC_USE_SHARED_CONTEXT
|
||||
// Reset the latest content. When the window is activated, the IME state
|
||||
// may be changed on other applications.
|
||||
sContent = nsnull;
|
||||
// We should enable the IME state for other applications.
|
||||
nsCOMPtr<nsIKBStateControl> kb = GetKBStateControl(aPresContext);
|
||||
if (kb)
|
||||
SetIMEState(aPresContext, nsIContent::IME_STATUS_ENABLE, kb);
|
||||
#endif // NS_KBSC_USE_SHARED_CONTEXT
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -5622,23 +5622,7 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
if (mCurrentEventFrame) {
|
||||
esm->GetFocusedContent(getter_AddRefs(mCurrentEventContent));
|
||||
} else {
|
||||
#if defined(MOZ_X11) || defined(XP_WIN)
|
||||
#if defined(MOZ_X11)
|
||||
if (NS_IS_IME_EVENT(aEvent)) {
|
||||
// bug 52416 (MOZ_X11)
|
||||
// Lookup region (candidate window) of UNIX IME grabs
|
||||
// input focus from Mozilla but wants to send IME event
|
||||
// to redraw pre-edit (composed) string
|
||||
// If Mozilla does not have input focus and event is IME,
|
||||
// sends IME event to pre-focused element
|
||||
#else
|
||||
if (NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent)) {
|
||||
// bug 292263 (XP_WIN)
|
||||
// If software keyboard has focus, it may send the key messages and
|
||||
// the IME messages to pre-focused window. Therefore, if Mozilla
|
||||
// doesn't have focus and event is key event or IME event, we should
|
||||
// send the events to pre-focused element.
|
||||
#endif /* defined(MOZ_X11) */
|
||||
if (NS_TargetUnfocusedEventToLastFocusedContent(aEvent)) {
|
||||
nsPIDOMWindow *ourWindow = mDocument->GetWindow();
|
||||
if (ourWindow) {
|
||||
nsIFocusController *focusController =
|
||||
@ -5659,7 +5643,6 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* defined(MOZ_X11) || defined(XP_WIN) */
|
||||
if (!mCurrentEventContent) {
|
||||
mCurrentEventContent = mDocument->GetRootContent();
|
||||
}
|
||||
|
@ -1180,4 +1180,33 @@ enum nsDragDropEventStatus {
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
|
||||
static PRBool NS_TargetUnfocusedEventToLastFocusedContent(nsEvent* aEvent)
|
||||
{
|
||||
#if defined(MOZ_X11) || defined(XP_MACOSX)
|
||||
// bug 52416 (MOZ_X11)
|
||||
// Lookup region (candidate window) of UNIX IME grabs
|
||||
// input focus from Mozilla but wants to send IME event
|
||||
// to redraw pre-edit (composed) string
|
||||
// If Mozilla does not have input focus and event is IME,
|
||||
// sends IME event to pre-focused element
|
||||
|
||||
// bug 417315 (XP_MACOSX)
|
||||
// The commit event when the window is deactivating is sent after
|
||||
// the next focused widget getting the focus.
|
||||
// We need to send the commit event to last focused content.
|
||||
|
||||
return NS_IS_IME_EVENT(aEvent);
|
||||
#elif defined(XP_WIN)
|
||||
// bug 292263 (XP_WIN)
|
||||
// If software keyboard has focus, it may send the key messages and
|
||||
// the IME messages to pre-focused window. Therefore, if Mozilla
|
||||
// doesn't have focus and event is key event or IME event, we should
|
||||
// send the events to pre-focused element.
|
||||
|
||||
return NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent);
|
||||
#else
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // nsGUIEvent_h__
|
||||
|
@ -47,15 +47,6 @@
|
||||
{ 0xa7, 0xfd, 0x17, 0x75, 0x01, 0xad, 0xec, 0x98 } }
|
||||
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
/*
|
||||
* If the all applications use same context for IME, i.e., When gecko changes
|
||||
* the state of IME, the same changes can be on other processes.
|
||||
* Then, NS_KBSC_USE_SHARED_CONTEXT should be defined.
|
||||
*/
|
||||
#define NS_KBSC_USE_SHARED_CONTEXT 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* interface to control keyboard input state
|
||||
*/
|
||||
|
@ -4183,8 +4183,6 @@ static BOOL keyUpAlreadySentKeyDown = NO;
|
||||
// nil -- otherwise the keyboard focus can end up in the wrong NSView.
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
nsTSMManager::CommitIME();
|
||||
|
||||
return [super resignFirstResponder];
|
||||
}
|
||||
|
||||
@ -4219,8 +4217,6 @@ static BOOL keyUpAlreadySentKeyDown = NO;
|
||||
|
||||
nsAutoRetainView kungFuDeathGrip(self);
|
||||
|
||||
nsTSMManager::CommitIME();
|
||||
|
||||
[self sendFocusEvent:NS_DEACTIVATE];
|
||||
[self sendFocusEvent:NS_LOSTFOCUS];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user