- Timestamp:
- Dec 21, 2010, 1:40:08 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/thread.cpp
r21308 r21529 687 687 winteb->o.odin.hmq = OSLibWinQueryMsgQueue(winteb->o.odin.hab); 688 688 rc = OSLibWinSetCp(winteb->o.odin.hmq, GetDisplayCodepage()); 689 dprintf(("WinSetCP was %sOK", rc ? "" : "not "));689 dprintf(("WinSetCP(%d) was %sOK", GetDisplayCodepage(), rc ? "" : "not ")); 690 690 hookInit(winteb->o.odin.hab); 691 691 -
trunk/src/user32/pmwindow.cpp
r21426 r21529 201 201 hookInit(hab); 202 202 203 //BOOL rc = WinSetCp(hmq, GetDisplayCodepage());204 //dprintf(("InitPM: WinSetCP was %s OK", rc ? "" : "not "));203 BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); 204 dprintf(("InitPM: WinSetCP(%d) was %sOK", GetDisplayCodepage(), rc ? "" : "not ")); 205 205 206 206 /* IM instace is created per message queue, that is, thread */ … … 948 948 { 949 949 MSG extramsg; 950 char cpfrom[10] = {0};951 char cpto[10] = {0};952 ULONG ulCpSize, ulCP, mp2l;953 954 mp2l = (ULONG)mp2 & 0x0000FFFF;955 950 memcpy(&extramsg, pWinMsg, sizeof(MSG)); 956 951 extramsg.message = WINWM_CHAR; 957 DosQueryCp(sizeof(ulCP), &ulCP, &ulCpSize); 958 sprintf(cpfrom,"IBM-%d\0", ulCP); 959 sprintf(cpto,"IBM-%d\0", GetDisplayCodepage()); 960 if (cp2cp(cpfrom, cpto, (char*)&mp2l, (char*)&extramsg.wParam, 1)) 961 extramsg.wParam = (ULONG)mp2l; 952 953 // convert character code if needed (normally not as both 954 // Win32ThreadProc() and InitPM() set the HMQ code page to the 955 // Windows ANSI code page) 956 ULONG cpFrom = WinQueryCp(HMQ_CURRENT); 957 ULONG cpTo = GetDisplayCodepage(); 958 if (cpFrom != cpTo) { 959 char from[3], to[3]; 960 *((USHORT*)&from) = SHORT1FROMMP(mp2); 961 from[2] = '\0'; 962 if (WinCpTranslateString(hab, cpFrom, from, cpTo, 3, to)) { 963 extramsg.wParam = *((USHORT*)&to); 964 dprintf(("OS2: WM_CHAR cp%d->cp%d: %08X->%08X", cpFrom, cpTo, 965 (int)SHORT1FROMMP(mp2), (int)extramsg.wParam)); 966 } else { 967 dprintf(("ERROR: cp%d->cp%d failed!", cpFrom, cpTo)); 968 } 969 } else { 970 extramsg.wParam = SHORT1FROMMP(mp2); 971 } 962 972 963 973 if(SHORT1FROMMP(mp1) & KC_DEADKEY) … … 1485 1495 } 1486 1496 1487 1488 1489 1490 1491 1497 case WM_CHAR: 1498 { 1499 dprintf(("PMFRAME:WM_CHAR")); 1500 break; 1501 } 1492 1502 1493 1503 case WM_ADJUSTWINDOWPOS: -
trunk/src/user32/win32wbase.cpp
r21463 r21529 1287 1287 ULONG Win32BaseWindow::MsgChar(MSG *msg) 1288 1288 { 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); 1290 1304 } 1291 1305 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.