Ignore:
Timestamp:
Aug 8, 2003, 3:30:22 PM (22 years ago)
Author:
sandervl
Message:

KOM: WM_IME_CHAR generation + processing added for DBCS input

File:
1 edited

Legend:

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

    r10204 r10216  
    1 /* $Id: windowmsg.cpp,v 1.46 2003-08-04 17:01:58 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.47 2003-08-08 13:30:22 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    3535#include "timer.h"
    3636
    37 #define DBG_LOCALLOG    DBG_windowmsg
     37#define DBG_LOCALLOG    DBG_windowmsg
    3838#include "dbglocal.h"
    3939
     
    5050    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
    5151    {
    52         if (msg->lParam)
     52    if (msg->lParam)
    5353        {
    5454/*            HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
     
    5656            /* before calling window proc, verify whether timer is still valid;
    5757               there's a slim chance that the application kills the timer
    58                between GetMessage and DispatchMessage API calls */
     58           between GetMessage and DispatchMessage API calls */
    5959            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam))
    6060                return 0; /* invalid winproc */
    6161
    62             return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
     62        return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
    6363                                   msg->message, msg->wParam, GetTickCount() );
    6464        }
     
    7676    if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
    7777    {
    78         if (msg->lParam)
     78    if (msg->lParam)
    7979        {
    8080/*            HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
     
    8282            /* before calling window proc, verify whether timer is still valid;
    8383               there's a slim chance that the application kills the timer
    84                between GetMessage and DispatchMessage API calls */
     84           between GetMessage and DispatchMessage API calls */
    8585            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam))
    8686                return 0; /* invalid winproc */
    8787
    88             return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
     88        return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
    8989                                   msg->message, msg->wParam, GetTickCount() );
    9090        }
     
    100100         (msg->message >  WM_SYSKEYUP)||
    101101         (msg->message == WM_CHAR)    ||
     102#ifdef __WIN32OS2__
     103         (msg->message == WM_DEADCHAR)||
     104         (msg->message == WM_IME_CHAR) )
     105#else
    102106         (msg->message == WM_DEADCHAR) )
     107#endif
    103108    {
    104109        SetLastError(ERROR_INVALID_PARAMETER);
     
    448453        return 0;
    449454
     455#ifdef __WIN32OS2__
     456    case WM_IME_CHAR:
     457    {
     458        // always DBCS char
     459        CHAR charA[ 2 ];
     460
     461        charA[ 0 ] = ( CHAR )( *pwparam >> 8 );
     462        charA[ 1 ] = ( CHAR )*pwparam;
     463
     464        MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )pwparam, 1);
     465
     466        return 0;
     467    }
     468#endif
     469
    450470    case WM_PAINTCLIPBOARD:
    451471    case WM_SIZECLIPBOARD:
     
    725745        return 0;
    726746
     747#ifdef __WIN32OS2__
     748    case WM_IME_CHAR:
     749    {   // always DBCS char
     750        CHAR charA[ 2 ];
     751
     752        WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )pwparam, 1, ( LPSTR )charA, 2, 0, 0 );
     753        *pwparam = ( charA[ 0 ] << 8 ) | charA[ 1 ];
     754
     755        return 0;
     756    }
     757#endif
     758
    727759    case WM_PAINTCLIPBOARD:
    728760    case WM_SIZECLIPBOARD:
     
    862894    LRESULT result;
    863895
    864 #ifdef __WIN32OS2__
    865     if( IsDBCSEnv() && msg == WM_CHAR )
    866     {
    867         static BYTE dbcsLead = 0;
    868         WCHAR charA = wParam;
    869         int size = dbcsLead ? 2 : 1;
    870 
    871         if( dbcsLead )
    872                charA = ( charA << 8 ) | dbcsLead;
    873         else if( IsDBCSLeadByte( wParam ))
    874         {
    875             dbcsLead = wParam;
    876             return 0;
    877         }
    878         MultiByteToWideChar( CP_ACP, 0, ( LPSTR )&charA, size, ( LPWSTR )&wParam, 1 );
    879 
    880         dbcsLead = 0;
    881     }
    882     else
    883 #endif
    884896    if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    885897
     
    888900
    889901#ifdef __WIN32OS2__
    890     if(IsDBCSEnv()) 
     902    if(IsDBCSEnv())
    891903    {
    892904      switch( msg )
     
    940952    LRESULT result;
    941953
    942 #ifdef __WIN32OS2__
    943     if( IsDBCSEnv() && msg == WM_CHAR )
    944     {
    945         char charA[ 2 ];
    946 
    947         if( WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )&wParam, 1, ( LPSTR )charA, 2, 0, 0 ) > 1 )
    948         {
    949             func( hwnd, msg, ( WPARAM )charA[ 0 ], lParam );
    950             wParam = charA[ 1 ];
    951         }
    952         else
    953             wParam = charA[ 0 ];
    954     }
    955     else
    956 #endif
    957954    if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0;
    958955
Note: See TracChangeset for help on using the changeset viewer.