diff src/windows/native/sun/windows/awt_Frame.cpp @ 4084:6303d3a93040

7034291: Regression : Preedit String on active client is committed into unexpected component Reviewed-by: art, naoto
author dcherepanov
date Fri, 29 Apr 2011 16:02:05 +0400
parents 43be19b7c945
children 997f464f8446
line wrap: on
line diff
--- a/src/windows/native/sun/windows/awt_Frame.cpp	Thu Apr 28 19:39:47 2011 +0400
+++ b/src/windows/native/sun/windows/awt_Frame.cpp	Fri Apr 29 16:02:05 2011 +0400
@@ -109,7 +109,7 @@
     m_isMenuDropped = FALSE;
     m_isInputMethodWindow = FALSE;
     m_isUndecorated = FALSE;
-    m_lastProxiedFocusOwner = NULL;
+    m_imeTargetComponent = NULL;
     m_actualFocusedWindow = NULL;
     m_iconic = FALSE;
     m_zoomed = FALSE;
@@ -311,6 +311,8 @@
     LRESULT retValue = 0L;
 
     AwtComponent *focusOwner = NULL;
+    AwtComponent *imeTargetComponent = NULL;
+
     // IME and input language related messages need to be sent to a window
     // which has the Java input focus
     switch (message) {
@@ -323,15 +325,29 @@
         case WM_IME_COMPOSITIONFULL:
         case WM_IME_SELECT:
         case WM_IME_CHAR:
-        case 0x0288: // WM_IME_REQUEST
+        case WM_IME_REQUEST:
         case WM_IME_KEYDOWN:
         case WM_IME_KEYUP:
         case WM_INPUTLANGCHANGEREQUEST:
         case WM_INPUTLANGCHANGE:
+            if (message == WM_IME_STARTCOMPOSITION) {
+                SetImeTargetComponent(sm_focusOwner);
+            }
+            imeTargetComponent = AwtComponent::GetComponent(GetImeTargetComponent());
+            if (imeTargetComponent != NULL &&
+                imeTargetComponent != this) // avoid recursive calls
+            {
+                retValue = imeTargetComponent->WindowProc(message, wParam, lParam);
+                mr = mrConsume;
+            }
+            if (message == WM_IME_ENDCOMPOSITION) {
+                SetImeTargetComponent(NULL);
+            }
+            break;
         // TODO: when a Choice's list is dropped down and we're scrolling in
         // the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
         case WM_MOUSEWHEEL:
-            focusOwner = AwtComponent::GetComponent(GetLastProxiedFocusOwner());
+            focusOwner = AwtComponent::GetComponent(sm_focusOwner);
             if  (focusOwner != NULL &&
                  focusOwner != this) // avoid recursive calls
             {