Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8076455

IME Composition Window is displayed on incorrect position

XMLWordPrintable

    • b65
    • Verified

        Environment:
        OS : Windows 7
        JDK : jdk 7/8

        Reproduction:
        The problem occurs when all the following conditions are met.
        1. LayoutManager with territory not including client area base point of a
        frame is used when GridLayout or FlowLayout is divided into horizontal side.
        2. Attach a heavy weight container on 1's area
        3. Attach input method client of active client on 2's container

        The test case IMFDemo.java made by the issue reporter is based on
        IMFDemo. When to input text in active client through IME, composition
        Windows is displayed on left side(see attached GridIMFDemo.png). In
        jdk6, it is shown below the component(GridIMFDemo6.png).
        The root cause is thought in awt_Comoponent.cpp.

        void AwtComponent::OpenCandidateWindow(int x, int y)
        {
            UINT bits = 1;
            RECT rc;
            GetWindowRect(GetHWnd(), &rc); // *1 getting RECT from focused peer

            for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) {
                if ( m_bitsCandType & bits )
                    SetCandidateWindow(iCandType, x-rc.left, y-rc.top);
            }
            if (m_bitsCandType != 0) {
                // REMIND: is there any chance GetProxyFocusOwner() returns NULL
        here?
                ::DefWindowProc(ImmGetHWnd(), // *2 sending message to frame
        (ImmGetHWnd())
                                WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
            }
        }

        Datum of the rectangle shown *1 is obtained from focused peer, but in
        *2, message is processed by the frame Window which controls HIMC. As a
        result, the peer that doesn't contain base point of frame client area
        is out of alignment.

              bae Andrew Brygin
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: