Bug 558976 part.2 Implement nsIWidget::NotifyIME() on Windows r=jimm

This commit is contained in:
Masayuki Nakano 2013-03-06 15:14:32 +09:00
Родитель 4d47d7f2b5
Коммит 35e5c6a418
5 изменённых файлов: 26 добавлений и 54 удалений

Просмотреть файл

@ -462,7 +462,7 @@ nsIMM32Handler::OnInputLangChange(nsWindow* aWindow,
("IMM32: OnInputLangChange, hWnd=%08x, wParam=%08x, lParam=%08x\n",
aWindow->GetWindowHandle(), wParam, lParam));
aWindow->ResetInputState();
aWindow->NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
NS_ASSERTION(!mIsComposing, "ResetInputState failed");
if (mIsComposing) {

Просмотреть файл

@ -6859,7 +6859,7 @@ LRESULT nsWindow::OnChar(const MSG &aMsg,
}
if (IMEHandler::IsComposingOn(this)) {
ResetInputState();
IMEHandler::NotifyIME(this, REQUEST_TO_COMMIT_COMPOSITION);
}
wchar_t uniChar;
@ -7360,9 +7360,10 @@ nsWindow::OnSysColorChanged()
**************************************************************
**************************************************************/
NS_IMETHODIMP nsWindow::ResetInputState()
NS_IMETHODIMP
nsWindow::NotifyIME(NotificationToIME aNotification)
{
return IMEHandler::NotifyIME(this, REQUEST_TO_COMMIT_COMPOSITION);
return IMEHandler::NotifyIME(this, aNotification);
}
NS_IMETHODIMP_(void)
@ -7386,11 +7387,6 @@ nsWindow::GetInputContext()
return mInputContext;
}
NS_IMETHODIMP nsWindow::CancelIMEComposition()
{
return IMEHandler::NotifyIME(this, REQUEST_TO_CANCEL_COMPOSITION);
}
NS_IMETHODIMP
nsWindow::GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState)
{
@ -7402,13 +7398,6 @@ nsWindow::GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState)
return NS_OK;
}
NS_IMETHODIMP
nsWindow::OnIMEFocusChange(bool aFocus)
{
return IMEHandler::NotifyIME(this, aFocus ? NOTIFY_IME_OF_FOCUS :
NOTIFY_IME_OF_BLUR);
}
NS_IMETHODIMP
nsWindow::OnIMETextChange(uint32_t aStart,
uint32_t aOldEnd,
@ -7417,12 +7406,6 @@ nsWindow::OnIMETextChange(uint32_t aStart,
return IMEHandler::NotifyIMEOfTextChange(aStart, aOldEnd, aNewEnd);
}
NS_IMETHODIMP
nsWindow::OnIMESelectionChange(void)
{
return IMEHandler::NotifyIME(this, NOTIFY_IME_OF_SELECTION_CHANGE);
}
nsIMEUpdatePreference
nsWindow::GetIMEUpdatePreference()
{

Просмотреть файл

@ -163,11 +163,10 @@ public:
double aDeltaZ,
uint32_t aModifierFlags,
uint32_t aAdditionalFlags);
NS_IMETHOD ResetInputState();
NS_IMETHOD NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE;
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
const InputContextAction& aAction);
NS_IMETHOD_(InputContext) GetInputContext();
NS_IMETHOD CancelIMEComposition();
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
NS_IMETHOD RegisterTouchWindow();
NS_IMETHOD UnregisterTouchWindow();
@ -176,9 +175,7 @@ public:
virtual nsTransparencyMode GetTransparencyMode();
virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
#endif // MOZ_XUL
NS_IMETHOD OnIMEFocusChange(bool aFocus);
NS_IMETHOD OnIMETextChange(uint32_t aStart, uint32_t aOldEnd, uint32_t aNewEnd);
NS_IMETHOD OnIMESelectionChange(void);
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);

Просмотреть файл

@ -1152,18 +1152,26 @@ MetroWidget::GetInputContext()
}
NS_IMETHODIMP
MetroWidget::ResetInputState()
MetroWidget::NotifyIME(NotificationToIME aNotification)
{
nsTextStore::CommitComposition(false);
return NS_OK;
}
NS_IMETHODIMP
MetroWidget::CancelIMEComposition()
{
nsTextStore::CommitComposition(true);
return NS_OK;
switch (aNotification) {
case REQUEST_TO_COMMIT_COMPOSITION:
nsTextStore::CommitComposition(false);
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
nsTextStore::CommitComposition(true);
return NS_OK;
case NOTIFY_IME_OF_FOCUS:
return nsTextStore::OnFocusChange(true, this,
mInputContext.mIMEState.mEnabled);
case NOTIFY_IME_OF_BLUR:
return nsTextStore::OnFocusChange(false, this,
mInputContext.mIMEState.mEnabled);
case NOTIFY_IME_OF_SELECTION_CHANGE:
return nsTextStore::OnSelectionChange();
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
}
NS_IMETHODIMP
@ -1174,13 +1182,6 @@ MetroWidget::GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState)
return NS_OK;
}
NS_IMETHODIMP
MetroWidget::OnIMEFocusChange(bool aFocus)
{
return nsTextStore::OnFocusChange(aFocus, this,
mInputContext.mIMEState.mEnabled);
}
NS_IMETHODIMP
MetroWidget::OnIMETextChange(uint32_t aStart,
uint32_t aOldEnd,
@ -1189,12 +1190,6 @@ MetroWidget::OnIMETextChange(uint32_t aStart,
return nsTextStore::OnTextChange(aStart, aOldEnd, aNewEnd);
}
NS_IMETHODIMP
MetroWidget::OnIMESelectionChange(void)
{
return nsTextStore::OnSelectionChange();
}
NS_IMETHODIMP
MetroWidget::ReparentNativeWidget(nsIWidget* aNewParent)
{

Просмотреть файл

@ -126,12 +126,9 @@ public:
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
const InputContextAction& aAction);
NS_IMETHOD_(nsIWidget::InputContext) GetInputContext();
NS_IMETHOD ResetInputState();
NS_IMETHOD CancelIMEComposition();
NS_IMETHOD NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE;
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
NS_IMETHOD OnIMEFocusChange(bool aFocus);
NS_IMETHOD OnIMETextChange(uint32_t aStart, uint32_t aOldEnd, uint32_t aNewEnd);
NS_IMETHOD OnIMESelectionChange(void);
// FrameworkView helpers
void SizeModeChanged();