Bug 1186015 part.2 Rename nsIMM32Handler to mozilla::widget::IMMHandler r=jimm+m_kato

This commit is contained in:
Masayuki Nakano 2015-07-23 12:31:28 +09:00
parent c431620f48
commit 60055fa28c
6 changed files with 670 additions and 624 deletions

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsIMM32Handler_h__
#define nsIMM32Handler_h__
#ifndef IMMHandler_h_
#define IMMHandler_h_
#include "nscore.h"
#include <windows.h>
@ -104,14 +104,8 @@ protected:
HIMC mIMC;
};
} // namespace widget
} // namespace mozilla
class nsIMM32Handler
class IMMHandler final
{
typedef mozilla::widget::IMEContext IMEContext;
typedef mozilla::widget::IMENotification IMENotification;
typedef mozilla::widget::MSGResult MSGResult;
public:
static void Initialize();
static void Terminate();
@ -186,8 +180,8 @@ protected:
WPARAM &wParam, LPARAM &lParam,
MSGResult& aResult);
nsIMM32Handler();
~nsIMM32Handler();
IMMHandler();
~IMMHandler();
// On*() methods return true if the caller of message handler shouldn't do
// anything anymore. Otherwise, false.
@ -432,4 +426,7 @@ protected:
static bool sHasFocus;
};
#endif // nsIMM32Handler_h__
} // namespace widget
} // namespace mozilla
#endif // IMMHandler_h_

View File

@ -19,7 +19,6 @@
#include "nsGkAtoms.h"
#include "nsIDOMKeyEvent.h"
#include "nsIIdleServiceInternal.h"
#include "nsIMM32Handler.h"
#include "nsMemory.h"
#include "nsPrintfCString.h"
#include "nsQuickSort.h"

View File

@ -5,8 +5,8 @@
#include "WinIMEHandler.h"
#include "IMMHandler.h"
#include "mozilla/Preferences.h"
#include "nsIMM32Handler.h"
#include "nsWindowDefs.h"
#ifdef NS_ENABLE_TSF
@ -52,7 +52,7 @@ IMEHandler::Initialize()
}
#endif // #ifdef NS_ENABLE_TSF
nsIMM32Handler::Initialize();
IMMHandler::Initialize();
}
// static
@ -66,7 +66,7 @@ IMEHandler::Terminate()
}
#endif // #ifdef NS_ENABLE_TSF
nsIMM32Handler::Terminate();
IMMHandler::Terminate();
}
// static
@ -113,11 +113,11 @@ IMEHandler::ProcessMessage(nsWindow* aWindow, UINT aMessage,
if (aResult.mConsumed) {
return true;
}
// If we don't support IMM in TSF mode, we don't use nsIMM32Handler.
// If we don't support IMM in TSF mode, we don't use IMMHandler.
if (!sIsIMMEnabled) {
return false;
}
// IME isn't implemented with IMM, nsIMM32Handler shouldn't handle any
// IME isn't implemented with IMM, IMMHandler shouldn't handle any
// messages.
if (!nsTextStore::IsIMM_IME()) {
return false;
@ -125,8 +125,8 @@ IMEHandler::ProcessMessage(nsWindow* aWindow, UINT aMessage,
}
#endif // #ifdef NS_ENABLE_TSF
return nsIMM32Handler::ProcessMessage(aWindow, aMessage, aWParam, aLParam,
aResult);
return IMMHandler::ProcessMessage(aWindow, aMessage, aWParam, aLParam,
aResult);
}
#ifdef NS_ENABLE_TSF
@ -144,11 +144,11 @@ IMEHandler::IsComposing()
{
#ifdef NS_ENABLE_TSF
if (IsTSFAvailable()) {
return nsTextStore::IsComposing() || nsIMM32Handler::IsComposing();
return nsTextStore::IsComposing() || IMMHandler::IsComposing();
}
#endif // #ifdef NS_ENABLE_TSF
return nsIMM32Handler::IsComposing();
return IMMHandler::IsComposing();
}
// static
@ -158,11 +158,11 @@ IMEHandler::IsComposingOn(nsWindow* aWindow)
#ifdef NS_ENABLE_TSF
if (IsTSFAvailable()) {
return nsTextStore::IsComposingOn(aWindow) ||
nsIMM32Handler::IsComposingOn(aWindow);
IMMHandler::IsComposingOn(aWindow);
}
#endif // #ifdef NS_ENABLE_TSF
return nsIMM32Handler::IsComposingOn(aWindow);
return IMMHandler::IsComposingOn(aWindow);
}
// static
@ -175,23 +175,22 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
switch (aIMENotification.mMessage) {
case NOTIFY_IME_OF_SELECTION_CHANGE: {
nsresult rv = nsTextStore::OnSelectionChange(aIMENotification);
// If IMM IME is active, we need to notify nsIMM32Handler of updating
// If IMM IME is active, we need to notify IMMHandler of updating
// composition change. It will adjust candidate window position or
// composition window position.
bool isIMMActive = IsIMMActive();
if (isIMMActive) {
nsIMM32Handler::OnUpdateComposition(aWindow);
IMMHandler::OnUpdateComposition(aWindow);
}
nsIMM32Handler::OnSelectionChange(aWindow, aIMENotification,
isIMMActive);
IMMHandler::OnSelectionChange(aWindow, aIMENotification, isIMMActive);
return rv;
}
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
// If IMM IME is active, we need to notify nsIMM32Handler of updating
// If IMM IME is active, we need to notify IMMHandler of updating
// composition change. It will adjust candidate window position or
// composition window position.
if (IsIMMActive()) {
nsIMM32Handler::OnUpdateComposition(aWindow);
IMMHandler::OnUpdateComposition(aWindow);
} else {
nsTextStore::OnUpdateComposition();
}
@ -199,31 +198,31 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
case NOTIFY_IME_OF_TEXT_CHANGE:
return nsTextStore::OnTextChange(aIMENotification);
case NOTIFY_IME_OF_FOCUS:
nsIMM32Handler::OnFocusChange(true, aWindow);
IMMHandler::OnFocusChange(true, aWindow);
return nsTextStore::OnFocusChange(true, aWindow,
aWindow->GetInputContext());
case NOTIFY_IME_OF_BLUR:
nsIMM32Handler::OnFocusChange(false, aWindow);
IMMHandler::OnFocusChange(false, aWindow);
return nsTextStore::OnFocusChange(false, aWindow,
aWindow->GetInputContext());
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
// If IMM IME is active, we should send a mouse button event via IMM.
if (IsIMMActive()) {
return nsIMM32Handler::OnMouseButtonEvent(aWindow, aIMENotification);
return IMMHandler::OnMouseButtonEvent(aWindow, aIMENotification);
}
return nsTextStore::OnMouseButtonEvent(aIMENotification);
case REQUEST_TO_COMMIT_COMPOSITION:
if (nsTextStore::IsComposingOn(aWindow)) {
nsTextStore::CommitComposition(false);
} else if (IsIMMActive()) {
nsIMM32Handler::CommitComposition(aWindow);
IMMHandler::CommitComposition(aWindow);
}
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
if (nsTextStore::IsComposingOn(aWindow)) {
nsTextStore::CommitComposition(true);
} else if (IsIMMActive()) {
nsIMM32Handler::CancelComposition(aWindow);
IMMHandler::CancelComposition(aWindow);
}
return NS_OK;
case NOTIFY_IME_OF_POSITION_CHANGE:
@ -236,25 +235,25 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
switch (aIMENotification.mMessage) {
case REQUEST_TO_COMMIT_COMPOSITION:
nsIMM32Handler::CommitComposition(aWindow);
IMMHandler::CommitComposition(aWindow);
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
nsIMM32Handler::CancelComposition(aWindow);
IMMHandler::CancelComposition(aWindow);
return NS_OK;
case NOTIFY_IME_OF_POSITION_CHANGE:
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
nsIMM32Handler::OnUpdateComposition(aWindow);
IMMHandler::OnUpdateComposition(aWindow);
return NS_OK;
case NOTIFY_IME_OF_SELECTION_CHANGE:
nsIMM32Handler::OnSelectionChange(aWindow, aIMENotification, true);
IMMHandler::OnSelectionChange(aWindow, aIMENotification, true);
return NS_OK;
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
return nsIMM32Handler::OnMouseButtonEvent(aWindow, aIMENotification);
return IMMHandler::OnMouseButtonEvent(aWindow, aIMENotification);
case NOTIFY_IME_OF_FOCUS:
nsIMM32Handler::OnFocusChange(true, aWindow);
IMMHandler::OnFocusChange(true, aWindow);
return NS_OK;
case NOTIFY_IME_OF_BLUR:
nsIMM32Handler::OnFocusChange(false, aWindow);
IMMHandler::OnFocusChange(false, aWindow);
#ifdef NS_ENABLE_TSF
// If a plugin gets focus while TSF has focus, we need to notify TSF of
// the blur.
@ -279,7 +278,7 @@ IMEHandler::GetUpdatePreference()
}
#endif //NS_ENABLE_TSF
return nsIMM32Handler::GetIMEUpdatePreference();
return IMMHandler::GetIMEUpdatePreference();
}
// static
@ -436,7 +435,7 @@ IMEHandler::CurrentKeyboardLayoutHasIME()
}
#endif // #ifdef NS_ENABLE_TSF
return nsIMM32Handler::IsIMEAvailable();
return IMMHandler::IsIMEAvailable();
}
#endif // #ifdef DEBUG

View File

@ -20,6 +20,7 @@ UNIFIED_SOURCES += [
'AudioSession.cpp',
'GfxInfo.cpp',
'IEnumFE.cpp',
'IMMHandler.cpp',
'InkCollector.cpp',
'JumpListItem.cpp',
'KeyboardLayout.cpp',
@ -31,7 +32,6 @@ UNIFIED_SOURCES += [
'nsDragService.cpp',
'nsIdleServiceWin.cpp',
'nsImageClipboard.cpp',
'nsIMM32Handler.cpp',
'nsLookAndFeel.cpp',
'nsNativeDragSource.cpp',
'nsNativeDragTarget.cpp',

View File

@ -94,7 +94,6 @@
#include "nsIRollupListener.h"
#include "nsIServiceManager.h"
#include "nsIClipboard.h"
#include "nsIMM32Handler.h"
#include "WinMouseScrollHandler.h"
#include "nsFontMetrics.h"
#include "nsIFontEnumerator.h"