Bug 801989 part.3 Set InputContext::mNativeIMEContext on Linux r=karlt
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 27 Oct 2012 08:35:21 +0900
changeset 111716 6e748a6c7216b23ffe9122abc6627b185e373547
parent 111715 8d2392ef0082135f2faad84c7a6e00fdb935212c
child 111717 80bb0b88086f6b271abb014e57fe2d3920e094cb
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerskarlt
bugs801989
milestone19.0a1
Bug 801989 part.3 Set InputContext::mNativeIMEContext on Linux r=karlt
widget/gtk2/nsWindow.cpp
widget/qt/nsWindow.cpp
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -5902,18 +5902,23 @@ nsWindow::SetInputContext(const InputCon
 
 NS_IMETHODIMP_(InputContext)
 nsWindow::GetInputContext()
 {
   InputContext context;
   if (!mIMModule) {
       context.mIMEState.mEnabled = IMEState::DISABLED;
       context.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
+      // If IME context isn't available on this widget, we should set |this|
+      // instead of nullptr since nullptr means that the platform has only one
+      // context per process.
+      context.mNativeIMEContext = this;
   } else {
       context = mIMModule->GetInputContext();
+      context.mNativeIMEContext = mIMModule;
   }
   return context;
 }
 
 NS_IMETHODIMP
 nsWindow::CancelIMEComposition()
 {
     return mIMModule ? mIMModule->CancelIMEComposition(this) : NS_OK;
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -3184,16 +3184,19 @@ nsWindow::SetInputContext(const InputCon
             break;
     }
 }
 
 NS_IMETHODIMP_(InputContext)
 nsWindow::GetInputContext()
 {
     mInputContext.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
+    // Our qt widget looks like using only one context per process.
+    // However, it's better to set the context's pointer.
+    mInputContext.mNativeIMEContext = qApp->inputContext();
     return mInputContext;
 }
 
 void
 nsWindow::SetSoftwareKeyboardState(bool aOpen,
                                    const InputContextAction& aAction)
 {
     if (aOpen) {