Support Chinese Input(ConsoleView.cpp)

force
2013-04-15
2013-10-18
  • force

    force - 2013-04-15

    Please change code console\ConsoleView.cpp

    In this Function

    BOOL ConsoleView::PreTranslateMessage(MSG* pMsg)
    {
        if ((pMsg->message == WM_KEYDOWN) ||
                (pMsg->message == WM_KEYUP) ||
                (pMsg->message == WM_SYSKEYDOWN) ||
                (pMsg->message == WM_SYSKEYUP))
        {
            // Avoid calling ::TranslateMessage for WM_KEYDOWN, WM_KEYUP,
            // WM_SYSKEYDOWN and WM_SYSKEYUP (except for wParam == VK_PACKET,
            // which is sent by SendInput when pasting text).
            ///
            // This prevents WM_CHAR and WM_SYSCHAR messages, enabling stuff like
            // handling 'dead' characters input and passing all keys to console.
            if (pMsg->wParam == VK_PACKET) return FALSE;
    
            //::DispatchMessage(pMsg); // origin
            //Add Chinese Input Support: begin
            ::TranslateMessage(pMsg);
            if(!::PeekMessage(pMsg, NULL, 0, 0, PM_NOREMOVE))
                ::DispatchMessage(pMsg);
    
            // Add Chinese Input Support: begin
            ::TranslateMessage(pMsg);
            if(!::PeekMessage(pMsg, NULL, 0, 0, PM_NOREMOVE))
                ::DispatchMessage(pMsg);
            // Add Chinese Input Support: end
            return TRUE;
        }
        return FALSE;
    }
    
     
    Last edit: Vivian De Smedt 2013-10-18
  • Vivian De Smedt

    Vivian De Smedt - 2013-10-18

    Dear ClangOnWin,

    It seems that your patch introduce a problem. The NumPad are not well supported anymore. To have back the support of the NumPad I have modified your patch.

    Could you confirm me that with this modified version your patch is still working?

    New version:

       // Add Chinese Input Support: >>
       //::TranslateMessage(pMsg);
       if(!::PeekMessage(pMsg, NULL, 0, 0, PM_NOREMOVE))
           ::DispatchMessage(pMsg);
       // Add Chinese Input Support: >>
    

    Old version:

       // Add Chinese Input Support: >>
       ::TranslateMessage(pMsg);
       if(!::PeekMessage(pMsg, NULL, 0, 0, PM_NOREMOVE))
           ::DispatchMessage(pMsg);
       // Add Chinese Input Support: >>
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks