--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1105,19 +1105,19 @@ public:
* Drop the JS objects held by aScriptObjectHolder.
*
* @param aScriptObjectHolder the object that holds JS objects that we want to
* drop
*/
static nsresult DropJSObjects(void* aScriptObjectHolder);
/**
- * Convert nsIContent::IME_STATUS_* to nsIKBStateControll::IME_STATUS_*
+ * Convert nsIContent::IME_STATUS_* to nsIWidget::IME_STATUS_*
*/
- static PRUint32 GetKBStateControlStatusFromIMEStatus(PRUint32 aState);
+ static PRUint32 GetWidgetStatusFromIMEStatus(PRUint32 aState);
/*
* Notify when the first XUL menu is opened and when the all XUL menus are
* closed. At opening, aInstalling should be TRUE, otherwise, it should be
* FALSE.
*/
static void NotifyInstalledMenuKeyboardListener(PRBool aInstalling);
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -131,17 +131,16 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
#include "nsICharsetConverterManager.h"
#include "nsIEventListenerManager.h"
#include "nsAttrName.h"
#include "nsIDOMUserDataHandler.h"
#include "nsContentCreatorFunctions.h"
#include "nsTPtrArray.h"
#include "nsGUIEvent.h"
#include "nsMutationEvent.h"
-#include "nsIKBStateControl.h"
#include "nsIMEStateManager.h"
#include "nsContentErrors.h"
#include "nsUnicharUtilCIID.h"
#include "nsICaseConversion.h"
#include "nsCompressedCharMap.h"
#include "nsINativeKeyBindings.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMNSEvent.h"
@@ -3788,28 +3787,28 @@ nsContentUtils::DropJSObjects(void* aScr
if (--sJSGCThingRootCount == 0 && !sInitialized) {
NS_RELEASE(sXPConnect);
}
return rv;
}
/* static */
PRUint32
-nsContentUtils::GetKBStateControlStatusFromIMEStatus(PRUint32 aState)
+nsContentUtils::GetWidgetStatusFromIMEStatus(PRUint32 aState)
{
switch (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
case nsIContent::IME_STATUS_DISABLE:
- return nsIKBStateControl::IME_STATUS_DISABLED;
+ return nsIWidget::IME_STATUS_DISABLED;
case nsIContent::IME_STATUS_ENABLE:
- return nsIKBStateControl::IME_STATUS_ENABLED;
+ return nsIWidget::IME_STATUS_ENABLED;
case nsIContent::IME_STATUS_PASSWORD:
- return nsIKBStateControl::IME_STATUS_PASSWORD;
+ return nsIWidget::IME_STATUS_PASSWORD;
default:
NS_ERROR("The given state doesn't have valid enable state");
- return nsIKBStateControl::IME_STATUS_ENABLED;
+ return nsIWidget::IME_STATUS_ENABLED;
}
}
/* static */
void
nsContentUtils::NotifyInstalledMenuKeyboardListener(PRBool aInstalling)
{
nsIMEStateManager::OnInstalledMenuKeyboardListener(aInstalling);
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -48,17 +48,16 @@
#include "nsEventListenerManager.h"
#include "nsIMEStateManager.h"
#include "nsQueryContentEventHandler.h"
#include "nsIContent.h"
#include "nsINodeInfo.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIWidget.h"
-#include "nsIKBStateControl.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsDOMEvent.h"
#include "nsGkAtoms.h"
#include "nsIEditorDocShell.h"
#include "nsIFormControl.h"
#include "nsIComboboxControlFrame.h"
#include "nsIDOMHTMLAnchorElement.h"
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -45,17 +45,16 @@
#include "nsIPresShell.h"
#include "nsISupports.h"
#include "nsPIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIEditorDocShell.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
-#include "nsIKBStateControl.h"
#include "nsIFocusController.h"
#include "nsIDOMWindow.h"
#include "nsContentUtils.h"
/******************************************************************/
/* nsIMEStateManager */
/******************************************************************/
@@ -81,21 +80,21 @@ nsIMEStateManager::OnRemoveContent(nsPre
{
NS_ENSURE_ARG_POINTER(aPresContext);
if (!sPresContext || !sContent ||
aPresContext != sPresContext ||
aContent != sContent)
return NS_OK;
// Current IME transaction should commit
- nsCOMPtr<nsIKBStateControl> kb = GetKBStateControl(sPresContext);
- if (kb) {
- nsresult rv = kb->CancelIMEComposition();
+ nsCOMPtr<nsIWidget> widget = GetWidget(sPresContext);
+ if (widget) {
+ nsresult rv = widget->CancelIMEComposition();
if (NS_FAILED(rv))
- kb->ResetInputState();
+ widget->ResetInputState();
}
sContent = nsnull;
sPresContext = nsnull;
return NS_OK;
}
@@ -105,57 +104,56 @@ nsIMEStateManager::OnChangeFocus(nsPresC
{
NS_ENSURE_ARG_POINTER(aPresContext);
if (!IsActive(aPresContext)) {
// The actual focus isn't changing, because this presContext isn't active.
return NS_OK;
}
- nsCOMPtr<nsIKBStateControl> kb = GetKBStateControl(aPresContext);
- if (!kb) {
- // This platform doesn't support IME controlling
+ nsCOMPtr<nsIWidget> widget = GetWidget(aPresContext);
+ if (!widget) {
return NS_OK;
}
PRUint32 newState = GetNewIMEState(aPresContext, aContent);
if (aPresContext == sPresContext && aContent == sContent) {
// actual focus isn't changing, but if IME enabled state is changing,
// we should do it.
PRUint32 newEnabledState = newState & nsIContent::IME_STATUS_MASK_ENABLED;
if (newEnabledState == 0) {
// the enabled state isn't changing, we should do nothing.
return NS_OK;
}
PRUint32 enabled;
- if (NS_FAILED(kb->GetIMEEnabled(&enabled))) {
+ if (NS_FAILED(widget->GetIMEEnabled(&enabled))) {
// this platform doesn't support IME controlling
return NS_OK;
}
if (enabled ==
- nsContentUtils::GetKBStateControlStatusFromIMEStatus(newEnabledState)) {
+ nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) {
// the enabled state isn't changing.
return NS_OK;
}
}
// Current IME transaction should commit
if (sPresContext) {
- nsCOMPtr<nsIKBStateControl> oldKB;
+ nsCOMPtr<nsIWidget> oldWidget;
if (sPresContext == aPresContext)
- oldKB = kb;
+ oldWidget = widget;
else
- oldKB = GetKBStateControl(sPresContext);
- if (oldKB)
- oldKB->ResetInputState();
+ oldWidget = GetWidget(sPresContext);
+ if (oldWidget)
+ oldWidget->ResetInputState();
}
if (newState != nsIContent::IME_STATUS_NONE) {
// Update IME state for new focus widget
- SetIMEState(aPresContext, newState, kb);
+ SetIMEState(aPresContext, newState, widget);
}
sPresContext = aPresContext;
sContent = aContent;
return NS_OK;
}
@@ -241,35 +239,33 @@ nsIMEStateManager::GetNewIMEState(nsPres
}
return aContent->GetDesiredIMEState();
}
void
nsIMEStateManager::SetIMEState(nsPresContext* aPresContext,
PRUint32 aState,
- nsIKBStateControl* aKB)
+ nsIWidget* aKB)
{
if (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
PRUint32 state =
- nsContentUtils::GetKBStateControlStatusFromIMEStatus(aState);
+ nsContentUtils::GetWidgetStatusFromIMEStatus(aState);
aKB->SetIMEEnabled(state);
}
if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
PRBool open = !!(aState & nsIContent::IME_STATUS_OPEN);
aKB->SetIMEOpenState(open);
}
}
-nsIKBStateControl*
-nsIMEStateManager::GetKBStateControl(nsPresContext* aPresContext)
+nsIWidget*
+nsIMEStateManager::GetWidget(nsPresContext* aPresContext)
{
nsIViewManager* vm = aPresContext->GetViewManager();
if (!vm)
return nsnull;
nsCOMPtr<nsIWidget> widget = nsnull;
nsresult rv = vm->GetWidget(getter_AddRefs(widget));
NS_ENSURE_SUCCESS(rv, nsnull);
- NS_ENSURE_TRUE(widget, nsnull);
- nsCOMPtr<nsIKBStateControl> kb = do_QueryInterface(widget);
- return kb;
+ return widget;
}
--- a/content/events/src/nsIMEStateManager.h
+++ b/content/events/src/nsIMEStateManager.h
@@ -39,17 +39,17 @@
#ifndef nsIMEStateManager_h__
#define nsIMEStateManager_h__
#include "nscore.h"
class nsIContent;
class nsPIDOMWindow;
class nsPresContext;
-class nsIKBStateControl;
+class nsIWidget;
class nsIFocusController;
/*
* IME state manager
*/
class nsIMEStateManager
{
@@ -60,24 +60,24 @@ public:
static nsresult OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent);
static nsresult OnActivate(nsPresContext* aPresContext);
static nsresult OnDeactivate(nsPresContext* aPresContext);
static void OnInstalledMenuKeyboardListener(PRBool aInstalling);
protected:
static void SetIMEState(nsPresContext* aPresContext,
PRUint32 aState,
- nsIKBStateControl* aKB);
+ nsIWidget* aKB);
static PRUint32 GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent);
static PRBool IsActive(nsPresContext* aPresContext);
static nsIFocusController* GetFocusController(nsPresContext* aPresContext);
- static nsIKBStateControl* GetKBStateControl(nsPresContext* aPresContext);
+ static nsIWidget* GetWidget(nsPresContext* aPresContext);
static nsIContent* sContent;
static nsPresContext* sPresContext;
static nsPIDOMWindow* sActiveWindow;
static PRBool sInstalledMenuKeyboardListener;
};
#endif // nsIMEStateManager_h__
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -73,17 +73,16 @@
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsISelectionController.h"
#include "nsIEnumerator.h"
#include "nsIAtom.h"
#include "nsICaret.h"
-#include "nsIKBStateControl.h"
#include "nsIWidget.h"
#include "nsIPlaintextEditor.h"
#include "nsGUIEvent.h" // nsTextEventReply
#include "nsIFrame.h" // Needed by IME code
#include "nsICSSStyleSheet.h"
@@ -2077,40 +2076,38 @@ GetEditorContentWindow(nsIPresShell *aPr
if (!*aResult)
return NS_ERROR_FAILURE;
NS_ADDREF(*aResult);
return NS_OK;
}
nsresult
-nsEditor::GetKBStateControl(nsIKBStateControl **aKBSC)
+nsEditor::GetWidget(nsIWidget **aWidget)
{
- if (!aKBSC)
+ if (!aWidget)
return NS_ERROR_NULL_POINTER;
- *aKBSC = nsnull;
+ *aWidget = nsnull;
nsCOMPtr<nsIPresShell> shell;
nsresult res = GetPresShell(getter_AddRefs(shell));
if (NS_FAILED(res))
return res;
if (!shell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIWidget> widget;
res = GetEditorContentWindow(shell, GetRoot(), getter_AddRefs(widget));
if (NS_FAILED(res))
return res;
-
- nsCOMPtr<nsIKBStateControl> kb = do_QueryInterface(widget);
- if (!kb)
- return NS_ERROR_NOT_INITIALIZED;
-
- NS_ADDREF(*aKBSC = kb);
+ if (!widget)
+ return NS_ERROR_NOT_AVAILABLE;
+
+ NS_ADDREF(*aWidget = widget);
return NS_OK;
}
NS_IMETHODIMP
nsEditor::ForceCompositionEnd()
{
@@ -2124,23 +2121,23 @@ nsEditor::ForceCompositionEnd()
return NS_OK;
#endif
#ifdef XP_UNIX
if(mFlags & nsIPlaintextEditor::eEditorPasswordMask)
return NS_OK;
#endif
- nsCOMPtr<nsIKBStateControl> kb;
- nsresult res = GetKBStateControl(getter_AddRefs(kb));
+ nsCOMPtr<nsIWidget> widget;
+ nsresult res = GetWidget(getter_AddRefs(widget));
if (NS_FAILED(res))
return res;
- if (kb) {
- res = kb->ResetInputState();
+ if (widget) {
+ res = widget->ResetInputState();
if (NS_FAILED(res))
return res;
}
return NS_OK;
}
NS_IMETHODIMP
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -40,17 +40,16 @@
#define __editor_h__
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsIEditor.h"
#include "nsIEditorIMESupport.h"
#include "nsIPhonetic.h"
-#include "nsIKBStateControl.h"
#include "nsIAtom.h"
#include "nsIDOMDocument.h"
#include "nsISelection.h"
#include "nsIDOMCharacterData.h"
#include "nsIPrivateTextRange.h"
#include "nsITransactionManager.h"
#include "nsIComponentManager.h"
@@ -334,18 +333,18 @@ protected:
PRBool bNoBlockCrossing = PR_FALSE);
// helper for GetNextNode
nsresult GetNextNodeImpl(nsIDOMNode *aCurrentNode,
PRBool aEditableNode,
nsCOMPtr<nsIDOMNode> *aResultNode,
PRBool bNoBlockCrossing = PR_FALSE);
- // Get nsIKBStateControl interface
- nsresult GetKBStateControl(nsIKBStateControl **aKBSC);
+ // Get nsIWidget interface
+ nsresult GetWidget(nsIWidget **aWidget);
// install the event listeners for the editor
nsresult InstallEventListeners();
virtual nsresult CreateEventListeners() = 0;
// unregister and release our event listeners
--- a/widget/public/Makefile.in
+++ b/widget/public/Makefile.in
@@ -45,17 +45,16 @@ include $(DEPTH)/config/autoconf.mk
MODULE = widget
XPIDL_MODULE = widget
GRE_MODULE = 1
EXPORTS = \
widgetCore.h \
nsStringUtil.h \
nsIWidget.h \
- nsIKBStateControl.h \
nsGUIEvent.h \
nsEvent.h \
nsIMouseListener.h \
nsIEventListener.h \
nsWidgetsCID.h \
nsILookAndFeel.h \
nsIPluginWidget.h \
nsINativeKeyBindings.h \
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -89,20 +89,20 @@ typedef nsEventStatus (*PR_CALLBACK EVEN
#define NS_NATIVE_PLUGIN_PORT 8
#define NS_NATIVE_SCREEN 9
#define NS_NATIVE_SHELLWIDGET 10 // Get the shell GtkWidget
#ifdef XP_MACOSX
#define NS_NATIVE_PLUGIN_PORT_QD 100
#define NS_NATIVE_PLUGIN_PORT_CG 101
#endif
-// 00e25b3d-c872-4985-a15e-8e650b7b8ff6
+// 594d22a3-ef2d-4189-9bc1-3c3da586f47a
#define NS_IWIDGET_IID \
-{ 0x00e25b3d, 0xc872, 0x4985, \
- { 0xa1, 0x5e, 0x8e, 0x65, 0x0b, 0x7b, 0x8f, 0xf6 } }
+{ 0x594d22a3, 0xef2d, 0x4189, \
+ { 0x9b, 0xc1, 0x3c, 0x3d, 0xa5, 0x86, 0xf4, 0x7a } }
// Hide the native window systems real window type so as to avoid
// including native window system types and APIs. This is necessary
// to ensure cross-platform code.
typedef void* nsNativeWidget;
/**
* Border styles
@@ -1113,16 +1113,94 @@ class nsIWidget : public nsISupports {
* Example: 1|0|4
* In this string, the first integer represents the top-level submenu
* in the native menu bar. Since the integer is 1, it is the second submeu
* in the native menu bar. Within that, the first item (index 0) is a
* submenu, and we want to activate the 5th item within that submenu.
*/
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) = 0;
+ /*
+ * Force Input Method Editor to commit the uncommited input
+ */
+ NS_IMETHOD ResetInputState()=0;
+
+ /*
+ * Following methods relates to IME 'Opened'/'Closed' state.
+ * 'Opened' means the user can input any character. I.e., users can input Japanese
+ * and other characters. The user can change the state to 'Closed'.
+ * 'Closed' means the user can input ASCII characters only. This is the same as a
+ * non-IME environment. The user can change the state to 'Opened'.
+ * For more information is here.
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=16940#c48
+ */
+
+ /*
+ * Set the state to 'Opened' or 'Closed'.
+ * If aState is TRUE, IME open state is set to 'Opened'.
+ * If aState is FALSE, set to 'Closed'.
+ */
+ NS_IMETHOD SetIMEOpenState(PRBool aState) = 0;
+
+ /*
+ * Get IME is 'Opened' or 'Closed'.
+ * If IME is 'Opened', aState is set PR_TRUE.
+ * If IME is 'Closed', aState is set PR_FALSE.
+ */
+ NS_IMETHOD GetIMEOpenState(PRBool* aState) = 0;
+
+ /*
+ * IME enabled states, the aState value of SetIMEEnabled/GetIMEEnabled
+ * should be one value of following values.
+ */
+ enum IMEStatus {
+ /*
+ * 'Disabled' means the user cannot use IME. So, the open state should be
+ * 'closed' during 'disabled'.
+ */
+ IME_STATUS_DISABLED = 0,
+ /*
+ * 'Enabled' means the user can use IME.
+ */
+ IME_STATUS_ENABLED = 1,
+ /*
+ * 'Password' state is a special case for the password editors.
+ * E.g., on mac, the password editors should disable the non-Roman
+ * keyboard layouts at getting focus. Thus, the password editor may have
+ * special rules on some platforms.
+ */
+ IME_STATUS_PASSWORD = 2
+ };
+
+ /*
+ * Set the state to 'Enabled' or 'Disabled' or 'Password'.
+ */
+ NS_IMETHOD SetIMEEnabled(PRUint32 aState) = 0;
+
+ /*
+ * Get IME is 'Enabled' or 'Disabled' or 'Password'.
+ */
+ NS_IMETHOD GetIMEEnabled(PRUint32* aState) = 0;
+
+ /*
+ * Destruct and don't commit the IME composition string.
+ */
+ NS_IMETHOD CancelIMEComposition() = 0;
+
+ /*
+ * Get toggled key states.
+ * aKeyCode should be NS_VK_CAPS_LOCK or NS_VK_NUM_LOCK or
+ * NS_VK_SCROLL_LOCK.
+ * aLEDState is the result for current LED state of the key.
+ * If the LED is 'ON', it returns TRUE, otherwise, FALSE.
+ * If the platform doesn't support the LED state (or we cannot get the
+ * state), this method returns NS_ERROR_NOT_IMPLEMENTED.
+ */
+ NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState) = 0;
+
protected:
// keep the list of children. We also keep track of our siblings.
// The ownership model is as follows: parent holds a strong ref to
// the first element of the list, and each element holds a strong
// ref to the next element in the list. The prevsibling and
// lastchild pointers are weak, which is fine as long as they are
// maintained properly.
nsCOMPtr<nsIWidget> mFirstChild;
--- a/widget/src/cocoa/nsChildView.h
+++ b/widget/src/cocoa/nsChildView.h
@@ -49,17 +49,16 @@
#include "nsISupports.h"
#include "nsBaseWidget.h"
#include "nsIPluginInstanceOwner.h"
#include "nsIPluginWidget.h"
#include "nsIScrollableView.h"
#include "nsWeakPtr.h"
#include "nsIWidget.h"
-#include "nsIKBStateControl.h"
#include "nsIAppShell.h"
#include "nsIMouseListener.h"
#include "nsIEventListener.h"
#include "nsString.h"
#include "nsIDragService.h"
#include "nsplugindefs.h"
@@ -224,38 +223,27 @@ private:
//-------------------------------------------------------------------------
//
// nsChildView
//
//-------------------------------------------------------------------------
class nsChildView : public nsBaseWidget,
- public nsIPluginWidget,
- public nsIKBStateControl
+ public nsIPluginWidget
{
private:
typedef nsBaseWidget Inherited;
public:
nsChildView();
virtual ~nsChildView();
NS_DECL_ISUPPORTS_INHERITED
- // nsIKBStateControl interface
- NS_IMETHOD ResetInputState();
- NS_IMETHOD SetIMEOpenState(PRBool aState);
- NS_IMETHOD GetIMEOpenState(PRBool* aState);
- NS_IMETHOD SetIMEEnabled(PRUint32 aState);
- NS_IMETHOD GetIMEEnabled(PRUint32* aState);
- NS_IMETHOD CancelIMEComposition();
- NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode,
- PRBool* aLEDState);
-
// nsIWidget interface
NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
@@ -338,16 +326,25 @@ public:
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD SetTitle(const nsAString& title);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
NS_IMETHOD ActivateNativeMenuItemAt(const nsAString& indexString);
+ NS_IMETHOD ResetInputState();
+ NS_IMETHOD SetIMEOpenState(PRBool aState);
+ NS_IMETHOD GetIMEOpenState(PRBool* aState);
+ NS_IMETHOD SetIMEEnabled(PRUint32 aState);
+ NS_IMETHOD GetIMEEnabled(PRUint32* aState);
+ NS_IMETHOD CancelIMEComposition();
+ NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode,
+ PRBool* aLEDState);
+
// nsIPluginWidget
NS_IMETHOD GetPluginClipRect(nsRect& outClipRect, nsPoint& outOrigin, PRBool& outWidgetVisible);
NS_IMETHOD StartDrawPlugin();
NS_IMETHOD EndDrawPlugin();
NS_IMETHOD SetPluginInstanceOwner(nsIPluginInstanceOwner* aInstanceOwner);
NS_IMETHOD GetHasTransparentBackground(PRBool& aTransparent);
NS_IMETHOD SetHasTransparentBackground(PRBool aTransparent);
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -439,17 +439,17 @@ nsChildView::~nsChildView()
// mGeckoChild are used throughout the ChildView class to tell if it's safe
// to use a ChildView object.
[mView widgetDestroyed]; // Safe if mView is nil.
mParentWidget = nil;
TearDownView(); // Safe if called twice.
}
-NS_IMPL_ISUPPORTS_INHERITED2(nsChildView, nsBaseWidget, nsIPluginWidget, nsIKBStateControl)
+NS_IMPL_ISUPPORTS_INHERITED1(nsChildView, nsBaseWidget, nsIPluginWidget)
// Utility method for implementing both Create(nsIWidget ...)
// and Create(nsNativeWidget...)
nsresult nsChildView::StandardCreate(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
@@ -1988,17 +1988,17 @@ NS_IMETHODIMP nsChildView::GetAttention(
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
#pragma mark -
// Force Input Method Editor to commit the uncommited input
-// Note that this and other nsIKBStateControl methods don't necessarily
+// Note that this and other IME methods don't necessarily
// get called on the same ChildView that input is going through.
NS_IMETHODIMP nsChildView::ResetInputState()
{
#ifdef DEBUG_IME
NSLog(@"**** ResetInputState");
#endif
nsTSMManager::CommitIME();
@@ -2032,25 +2032,25 @@ NS_IMETHODIMP nsChildView::GetIMEOpenSta
NS_IMETHODIMP nsChildView::SetIMEEnabled(PRUint32 aState)
{
#ifdef DEBUG_IME
NSLog(@"**** SetIMEEnabled aState = %d", aState);
#endif
switch (aState) {
- case nsIKBStateControl::IME_STATUS_ENABLED:
+ case nsIWidget::IME_STATUS_ENABLED:
nsTSMManager::SetRomanKeyboardsOnly(PR_FALSE);
nsTSMManager::EnableIME(PR_TRUE);
break;
- case nsIKBStateControl::IME_STATUS_DISABLED:
+ case nsIWidget::IME_STATUS_DISABLED:
nsTSMManager::SetRomanKeyboardsOnly(PR_FALSE);
nsTSMManager::EnableIME(PR_FALSE);
break;
- case nsIKBStateControl::IME_STATUS_PASSWORD:
+ case nsIWidget::IME_STATUS_PASSWORD:
nsTSMManager::SetRomanKeyboardsOnly(PR_TRUE);
nsTSMManager::EnableIME(PR_FALSE);
break;
default:
NS_ERROR("not implemented!");
}
return NS_OK;
}
@@ -2058,21 +2058,21 @@ NS_IMETHODIMP nsChildView::SetIMEEnabled
NS_IMETHODIMP nsChildView::GetIMEEnabled(PRUint32* aState)
{
#ifdef DEBUG_IME
NSLog(@"**** GetIMEEnabled");
#endif
if (nsTSMManager::IsIMEEnabled())
- *aState = nsIKBStateControl::IME_STATUS_ENABLED;
+ *aState = nsIWidget::IME_STATUS_ENABLED;
else if (nsTSMManager::IsRomanKeyboardsOnly())
- *aState = nsIKBStateControl::IME_STATUS_PASSWORD;
+ *aState = nsIWidget::IME_STATUS_PASSWORD;
else
- *aState = nsIKBStateControl::IME_STATUS_DISABLED;
+ *aState = nsIWidget::IME_STATUS_DISABLED;
return NS_OK;
}
// Destruct and don't commit the IME composition string.
NS_IMETHODIMP nsChildView::CancelIMEComposition()
{
#ifdef DEBUG_IME
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -378,24 +378,18 @@ nsWindow::ReleaseGlobals()
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gCursorCache); ++i) {
if (gCursorCache[i]) {
gdk_cursor_unref(gCursorCache[i]);
gCursorCache[i] = nsnull;
}
}
}
-#ifndef USE_XIM
NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsCommonWidget,
nsISupportsWeakReference)
-#else
-NS_IMPL_ISUPPORTS_INHERITED2(nsWindow, nsCommonWidget,
- nsISupportsWeakReference,
- nsIKBStateControl)
-#endif
NS_IMETHODIMP
nsWindow::Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
@@ -5491,17 +5485,17 @@ nsWindow::IMEDestroyContext(void)
// to unset the focus on this window before we destroy the window.
GtkIMContext *im = IMEGetContext();
if (im && gIMEFocusWindow && gIMEFocusWindow->IMEGetContext() == im) {
gIMEFocusWindow->IMELoseFocus();
gIMEFocusWindow = nsnull;
}
mIMEData->mOwner = nsnull;
- mIMEData->mEnabled = nsIKBStateControl::IME_STATUS_DISABLED;
+ mIMEData->mEnabled = nsIWidget::IME_STATUS_DISABLED;
if (mIMEData->mContext) {
workaround_gtk_im_display_closed(GTK_WIDGET(mContainer),
mIMEData->mContext);
gtk_im_context_set_client_window(mIMEData->mContext, nsnull);
g_object_unref(G_OBJECT(mIMEData->mContext));
mIMEData->mContext = nsnull;
}
@@ -5678,30 +5672,30 @@ GtkIMContext*
nsWindow::IMEGetContext()
{
return IM_get_input_context(this);
}
static PRBool
IsIMEEnabledState(PRUint32 aState)
{
- return aState == nsIKBStateControl::IME_STATUS_ENABLED;
+ return aState == nsIWidget::IME_STATUS_ENABLED;
}
PRBool
nsWindow::IMEIsEnabledState(void)
{
return mIMEData ? IsIMEEnabledState(mIMEData->mEnabled) : PR_FALSE;
}
static PRBool
IsIMEEditableState(PRUint32 aState)
{
- return aState == nsIKBStateControl::IME_STATUS_ENABLED ||
- aState == nsIKBStateControl::IME_STATUS_PASSWORD;
+ return aState == nsIWidget::IME_STATUS_ENABLED ||
+ aState == nsIWidget::IME_STATUS_PASSWORD;
}
PRBool
nsWindow::IMEIsEditableState(void)
{
return mIMEData ? IsIMEEditableState(mIMEData->mEnabled) : PR_FALSE;
}
@@ -5782,17 +5776,16 @@ nsWindow::IMEFilterEvent(GdkEventKey *aE
gKeyEventChanged = PR_FALSE;
gKeyEventCommitted = PR_FALSE;
gKeyEventChanged = PR_FALSE;
return retval;
}
-/* nsIKBStateControl */
NS_IMETHODIMP
nsWindow::ResetInputState()
{
IMEInitData();
nsRefPtr<nsWindow> win = IMEComposingWindow();
if (win) {
GtkIMContext *im = IMEGetContext();
@@ -5869,17 +5862,17 @@ nsWindow::SetIMEEnabled(PRUint32 aState)
NS_IMETHODIMP
nsWindow::GetIMEEnabled(PRUint32* aState)
{
NS_ENSURE_ARG_POINTER(aState);
IMEInitData();
*aState =
- mIMEData ? mIMEData->mEnabled : nsIKBStateControl::IME_STATUS_DISABLED;
+ mIMEData ? mIMEData->mEnabled : nsIWidget::IME_STATUS_DISABLED;
return NS_OK;
}
NS_IMETHODIMP
nsWindow::CancelIMEComposition()
{
IMEInitData();
@@ -6190,19 +6183,19 @@ IM_get_owning_window(MozDrawingarea *aAr
GtkIMContext *
IM_get_input_context(nsWindow *aWindow)
{
if (!aWindow)
return nsnull;
nsWindow::nsIMEData *data = aWindow->mIMEData;
if (!data)
return nsnull;
- if (data->mEnabled == nsIKBStateControl::IME_STATUS_ENABLED)
+ if (data->mEnabled == nsIWidget::IME_STATUS_ENABLED)
return data->mContext;
- if (data->mEnabled == nsIKBStateControl::IME_STATUS_PASSWORD)
+ if (data->mEnabled == nsIWidget::IME_STATUS_PASSWORD)
return data->mSimpleContext;
return data->mDummyContext;
}
#endif
/* static */ already_AddRefed<gfxASurface>
nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
--- a/widget/src/gtk2/nsWindow.h
+++ b/widget/src/gtk2/nsWindow.h
@@ -62,23 +62,19 @@
#ifdef ACCESSIBILITY
#include "nsIAccessNode.h"
#include "nsIAccessible.h"
#endif
#ifdef USE_XIM
#include <gtk/gtkimmulticontext.h>
#include "pldhash.h"
-#include "nsIKBStateControl.h"
#endif
class nsWindow : public nsCommonWidget, public nsSupportsWeakReference
-#ifdef USE_XIM
- ,public nsIKBStateControl
-#endif
{
public:
nsWindow();
virtual ~nsWindow();
static void ReleaseGlobals();
NS_DECL_ISUPPORTS_INHERITED
@@ -337,22 +333,21 @@ public:
PRUint32 mEnabled;
nsIMEData(nsWindow* aOwner) {
mContext = nsnull;
mSimpleContext = nsnull;
mDummyContext = nsnull;
mComposingWindow = nsnull;
mOwner = aOwner;
mRefCount = 1;
- mEnabled = nsIKBStateControl::IME_STATUS_ENABLED;
+ mEnabled = nsIWidget::IME_STATUS_ENABLED;
}
};
nsIMEData *mIMEData;
- // nsIKBStateControl interface
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRUint32 aState);
NS_IMETHOD GetIMEEnabled(PRUint32* aState);
NS_IMETHOD CancelIMEComposition();
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
--- a/widget/src/photon/nsWidget.cpp
+++ b/widget/src/photon/nsWidget.cpp
@@ -147,17 +147,17 @@ nsWidget::~nsWidget( ) {
}
}
//-------------------------------------------------------------------------
//
// nsISupport stuff
//
//-------------------------------------------------------------------------
-NS_IMPL_ISUPPORTS_INHERITED1(nsWidget, nsBaseWidget, nsIKBStateControl)
+NS_IMPL_ISUPPORTS_INHERITED0(nsWidget, nsBaseWidget)
NS_METHOD nsWidget::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect ) {
if( mWidget ) {
/* This is NOT correct */
aNewRect.x = aOldRect.x;
aNewRect.y = aOldRect.y;
}
return NS_OK;
@@ -216,51 +216,16 @@ void nsWidget::DestroyNative( void ) {
void nsWidget::OnDestroy( ) {
mOnDestroyCalled = PR_TRUE;
// release references to children, device context, toolkit + app shell
nsBaseWidget::OnDestroy();
DispatchStandardEvent(NS_DESTROY);
}
-//////////////////////////////////////////////////////////////////////
-//
-// nsIKBStateControl Mehthods
-//
-//////////////////////////////////////////////////////////////////////
-
-NS_IMETHODIMP nsWidget::ResetInputState( ) {
- return NS_OK;
- }
-
-NS_IMETHODIMP nsWidget::SetIMEOpenState(PRBool aState) {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
-NS_IMETHODIMP nsWidget::GetIMEOpenState(PRBool* aState) {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
-NS_IMETHODIMP nsWidget::SetIMEEnabled(PRUint32 aState) {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
-NS_IMETHODIMP nsWidget::GetIMEEnabled(PRUint32* aState) {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
-NS_IMETHODIMP nsWidget::CancelIMEComposition() {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
-NS_IMETHODIMP nsWidget::GetToggledKeyState(PRUint32 aKeyCode,
- PRBool* aLEDState) {
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
//-------------------------------------------------------------------------
//
// Hide or show this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWidget::Show( PRBool bState ) {
--- a/widget/src/photon/nsWidget.h
+++ b/widget/src/photon/nsWidget.h
@@ -34,17 +34,16 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsWidget_h__
#define nsWidget_h__
#include "nsBaseWidget.h"
-#include "nsIKBStateControl.h"
#include "nsIRegion.h"
#ifdef PHOTON_DND
#include "nsIDragService.h"
#endif
#include "nsClipboard.h"
class nsILookAndFeel;
class nsIAppShell;
@@ -56,17 +55,17 @@ class nsWidget;
#define NS_TO_PH_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
#define PH_TO_NS_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
/**
* Base of all Photon native widgets.
*/
-class nsWidget : public nsBaseWidget, nsIKBStateControl
+class nsWidget : public nsBaseWidget
{
public:
nsWidget();
virtual ~nsWidget();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget
@@ -206,26 +205,16 @@ public:
{
/* if the widget has been invalidated or damaged then re-draw it */
PtFlush();
return NS_OK;
}
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
-
- // nsIKBStateControl
- NS_IMETHOD ResetInputState();
- NS_IMETHOD SetIMEOpenState(PRBool aState);
- NS_IMETHOD GetIMEOpenState(PRBool* aState);
- NS_IMETHOD SetIMEEnabled(PRUint32 aState);
- NS_IMETHOD GetIMEEnabled(PRUint32* aState);
- NS_IMETHOD CancelIMEComposition();
- NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
-
inline void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull)
{
if( aPoint == nsnull ) {
event.refPoint.x = 0;
event.refPoint.y = 0;
}
else {
event.refPoint.x = aPoint->x;
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -691,17 +691,17 @@ nsWindow::nsWindow() : nsBaseWidget()
mIsInMouseCapture = PR_FALSE;
mIsInMouseWheelProcessing = PR_FALSE;
mLastSize.width = 0;
mLastSize.height = 0;
mOldStyle = 0;
mOldExStyle = 0;
mPainting = 0;
mOldIMC = NULL;
- mIMEEnabled = nsIKBStateControl::IME_STATUS_ENABLED;
+ mIMEEnabled = nsIWidget::IME_STATUS_ENABLED;
mLeadByte = '\0';
mBlurEventSuppressionLevel = 0;
static BOOL gbInitGlobalValue = FALSE;
if (! gbInitGlobalValue) {
gbInitGlobalValue = TRUE;
gKeyboardLayout = GetKeyboardLayout(0);
@@ -791,17 +791,17 @@ nsWindow::~nsWindow()
}
}
#endif
NS_IF_RELEASE(mNativeDragTarget);
}
-NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsBaseWidget, nsIKBStateControl)
+NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
NS_METHOD nsWindow::CaptureMouse(PRBool aCapture)
{
if (!nsToolkit::gMouseTrailer) {
NS_ERROR("nsWindow::CaptureMouse called after nsToolkit destroyed");
return NS_OK;
}
@@ -7326,17 +7326,17 @@ NS_IMETHODIMP nsWindow::GetIMEOpenState(
}
//==========================================================================
NS_IMETHODIMP nsWindow::SetIMEEnabled(PRUint32 aState)
{
if (sIMEIsComposing)
ResetInputState();
mIMEEnabled = aState;
- PRBool enable = (aState == nsIKBStateControl::IME_STATUS_ENABLED);
+ PRBool enable = (aState == nsIWidget::IME_STATUS_ENABLED);
if (!enable != !mOldIMC)
return NS_OK;
mOldIMC = ::ImmAssociateContext(mWnd, enable ? mOldIMC : NULL);
NS_ASSERTION(!enable || !mOldIMC, "Another IMC was associated");
return NS_OK;
}
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -44,17 +44,16 @@
#define Window_h__
#include "nsBaseWidget.h"
#include "nsdefs.h"
#include "nsSwitchToUIThread.h"
#include "nsToolkit.h"
#include "nsIWidget.h"
-#include "nsIKBStateControl.h"
#include "nsIMouseListener.h"
#include "nsIEventListener.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsTArray.h"
@@ -109,18 +108,17 @@ const LPCSTR kClassNameContentFrame =
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
const LPCSTR kClassNameDialog = "MozillaDialogClass";
/**
* Native WIN32 window wrapper.
*/
class nsWindow : public nsSwitchToUIThread,
- public nsBaseWidget,
- public nsIKBStateControl
+ public nsBaseWidget
{
public:
nsWindow();
virtual ~nsWindow();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget interface
@@ -218,18 +216,16 @@ private:
nsresult SetWindowTranslucencyInner(PRBool aTransparent);
PRBool GetWindowTranslucencyInner() { return mIsTransparent; }
void ResizeTranslucentWindow(PRInt32 aNewWidth, PRInt32 aNewHeight, PRBool force = PR_FALSE);
nsresult UpdateTranslucentWindow();
nsresult SetupTranslucentWindowMemoryBitmap(PRBool aTransparent);
public:
#endif
- // nsIKBStateControl interface
-
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRUint32 aState);
NS_IMETHOD GetIMEEnabled(PRUint32* aState);
NS_IMETHOD CancelIMEComposition();
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
--- a/widget/src/xpwidgets/nsBaseWidget.h
+++ b/widget/src/xpwidgets/nsBaseWidget.h
@@ -132,16 +132,23 @@ public:
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
NS_IMETHOD BeginSecureKeyboardInput();
NS_IMETHOD EndSecureKeyboardInput();
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD ResetInputState() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEOpenState(PRBool aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEOpenState(PRBool* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEEnabled(PRUint32 aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEEnabled(PRUint32* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD CancelIMEComposition() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState) { return NS_ERROR_NOT_IMPLEMENTED; }
protected:
virtual void ResolveIconName(const nsAString &aIconName,
const nsAString &aIconSuffix,
nsILocalFile **aResult);
virtual void OnDestroy();
virtual void BaseCreate(nsIWidget *aParent,