Ignore:
Timestamp:
Dec 21, 2010, 1:40:08 AM (15 years ago)
Author:
dmik
Message:

Fixed completely broken national (non-Latin1) character input in Odin. There were two problems:
1) When translating OS2 WM_CHAR to Win32 WM_CHAR in UNICODE mode, ANSI->UNICODE conversion of the character was not done.
2) When hosting windows on threads created with CreateThread(), characters in WM_CHAR were wrongly converted from OS/2 codepage to ANSI codepage while they already were in ANSI due to the message queue begin switched to it at thread startup.
3) The main thread's message queue is now also switched to ANSI at startup so the conversion from step 2) should normally not take place now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r21463 r21529  
    12871287ULONG Win32BaseWindow::MsgChar(MSG *msg)
    12881288{
    1289     return IsWindowUnicode() ? DispatchMsgW( msg ) : DispatchMsgA( msg );
     1289    if (IsWindowUnicode()) {
     1290        // Unicode windows expect the character code in UTF-16 while we save it
     1291        // in ascii format, so we need to convert before sending to the window
     1292        if (msg->message == WINWM_CHAR) {
     1293            CHAR  charA;
     1294            WCHAR charW;
     1295
     1296            charA = msg->wParam;
     1297            MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
     1298            msg->wParam= charW;
     1299            dprintf(("MsgChar: Convert to Unicode src=%x res=%x", charA, charW));
     1300        }
     1301        return DispatchMsgW(msg);
     1302    }
     1303    return DispatchMsgA(msg);
    12901304}
    12911305//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.