Ignore:
Timestamp:
May 24, 2004, 11:02:01 AM (21 years ago)
Author:
sandervl
Message:

KOM: Updates

File:
1 edited

Legend:

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

    r10602 r10607  
    1 /* $Id: windowmsg.cpp,v 1.50 2004-05-11 09:08:20 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.51 2004-05-24 09:02:01 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    3434#define INCL_TIMERWIN32
    3535#include "timer.h"
    36 #include "callwrap.h"
    3736
    3837#define DBG_LOCALLOG    DBG_windowmsg
     
    327326 * @author  knut st. osmundsen <bird-srcspam@anduin.net>
    328327 * @remark  One cannot attach a threads input queue to it self.
    329  * @remark  This implemenation requires the thread which input is 'forwarded' to
    330  *          process it's message queue. Window (and wine) will not bother that thread
    331  *          at all with the messages. (DEADLOCK WARNING)
    332328 * @todo    Not sure if all this is 100% ok according to the windows reality.
    333329 *          I'm sure some error cases aren't caught.
     
    566562    case WM_IME_CHAR:
    567563    {
    568         // always DBCS char
    569564        CHAR charA[ 2 ];
    570 
    571         charA[ 0 ] = ( CHAR )( *pwparam >> 8 );
    572         charA[ 1 ] = ( CHAR )*pwparam;
    573 
    574         MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )pwparam, 1);
     565        INT  lenA = 1;
     566
     567        if( IsDBCSLeadByte(( CHAR )( *pwparam >> 8 )))
     568        {
     569            charA[ 0 ] = ( CHAR )( *pwparam >> 8 );
     570            charA[ 1 ] = ( CHAR )*pwparam;
     571            lenA = 2;
     572        }
     573        else
     574            charA[ 0 ] = ( CHAR )*pwparam;
     575
     576        MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, lenA, ( LPWSTR )pwparam, 1);
    575577
    576578        return 0;
     
    857859#ifdef __WIN32OS2__
    858860    case WM_IME_CHAR:
    859     {   // always DBCS char
     861    {
    860862        CHAR charA[ 2 ];
    861 
    862         WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )pwparam, 1, ( LPSTR )charA, 2, 0, 0 );
    863         *pwparam = ( charA[ 0 ] << 8 ) | charA[ 1 ];
     863        INT  lenA;
     864
     865        lenA = WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )pwparam, 1, ( LPSTR )charA, 2, 0, 0 );
     866        if( lenA > 1 )
     867            *pwparam = ( charA[ 0 ] << 8 ) | charA[ 1 ];
     868        else
     869            *pwparam = charA[ 0 ];
    864870
    865871        return 0;
     
    10031009{
    10041010    LRESULT result;
     1011    LPARAM old = lParam;
    10051012
    10061013    if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    10071014
    1008     result = WrapCallback4(func, hwnd, msg, wParam, lParam );
     1015    result = func( hwnd, msg, wParam, lParam );
    10091016    WINPROC_UnmapMsg32ATo32W( hwnd, msg, wParam, lParam );
    10101017
     
    10171024        {
    10181025            LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR ));
    1019             result = WrapCallback4(func, hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )ustr );
     1026            result = func( hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )ustr );
    10201027            result = lstrlenWtoA( ustr, result );
    10211028            HeapFree( GetProcessHeap(), 0, ustr );
     
    10261033        {
    10271034            LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR ));
    1028             result = WrapCallback4(func, hwnd, LB_GETTEXT, wParam, ( LPARAM )ustr );
     1035            result = func( hwnd, LB_GETTEXT, wParam, ( LPARAM )ustr );
    10291036            if( result != LB_ERR )
    10301037                result = lstrlenWtoA( ustr, result );
     
    10381045        {
    10391046            LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR ));
    1040             result = WrapCallback4(func, hwnd, CB_GETLBTEXT, wParam, ( LPARAM )ustr );
     1047            result = func( hwnd, CB_GETLBTEXT, wParam, ( LPARAM )ustr );
    10411048            if( result != CB_ERR )
    10421049                result = lstrlenWtoA( ustr, result );
     
    10641071    if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    10651072
    1066     result = WrapCallback4(func, hwnd, msg, wParam, lParam );
     1073    result = func( hwnd, msg, wParam, lParam );
    10671074    WINPROC_UnmapMsg32WTo32A( hwnd, msg, wParam, lParam );
    10681075
     
    10751082        {
    10761083            LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 );
    1077             result = WrapCallback4(func, hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )astr );
     1084            result = func( hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )astr );
    10781085            result = lstrlenAtoW( astr, result );
    10791086            HeapFree( GetProcessHeap(), 0, astr );
     
    10841091        {
    10851092            LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 );
    1086             result = WrapCallback4(func, hwnd, LB_GETTEXT, wParam, ( LPARAM )astr );
     1093            result = func( hwnd, LB_GETTEXT, wParam, ( LPARAM )astr );
    10871094            if( result != LB_ERR )
    10881095                result = lstrlenAtoW( astr, result );
     
    10961103        {
    10971104            LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 );
    1098             result = WrapCallback4(func, hwnd, CB_GETLBTEXT, wParam, ( LPARAM )astr );
     1105            result = func( hwnd, CB_GETLBTEXT, wParam, ( LPARAM )astr );
    10991106            if( result != CB_ERR )
    11001107                result = lstrlenAtoW( astr, result );
Note: See TracChangeset for help on using the changeset viewer.