Ignore:
Timestamp:
Jul 31, 2003, 5:58:58 PM (22 years ago)
Author:
sandervl
Message:

KOMH: DBCS updates/fixes

File:
1 edited

Legend:

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

    r10189 r10190  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.112 2003-07-31 12:25:57 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.113 2003-07-31 15:56:44 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    3838#include <winkeyboard.h>
    3939#include <winnls.h>
     40#include <heapstring.h>
    4041#include "hook.h"
    4142#include "user32api.h"
     
    732733        WORD  wWinScan;
    733734
    734         if (scanCode==0) goto dummymessage;
    735 
    736         KeyTranslatePMScanToWinVKey(usPMScanCode,
    737                                     FALSE,
    738                                     &bWinVKey,
    739                                     &wWinScan,
    740                                     &fWinExtended);
    741         winMsg->wParam = bWinVKey;
     735        if ( (!IsDBCSEnv() && scanCode == 0) ||
     736             (scanCode==0 ) && !( flags & KC_CHAR ) )
     737        {
     738            goto dummymessage;
     739        }
     740
     741        if( scanCode != 0 )
     742        {
     743            KeyTranslatePMScanToWinVKey(usPMScanCode,
     744                                        FALSE,
     745                                        &bWinVKey,
     746                                        &wWinScan,
     747                                        &fWinExtended);
     748            winMsg->wParam = bWinVKey;
     749        }
     750        else
     751        {
     752            dprintf(("PM: WM_CHAR: DBCS processing "));
     753
     754            winMsg->wParam = CHAR1FROMMP( os2Msg->mp2 );
     755
     756            wWinScan = 0;
     757            fWinExtended = 0;
     758
     759            if( CHAR2FROMMP( os2Msg->mp2 ))     // DBCS character
     760            {
     761                if( isUnicode )
     762                {
     763                    char  dbcsCh[] = { CHAR1FROMMP( os2Msg->mp2 ), CHAR2FROMMP( os2Msg->mp2 ), 0 };
     764                    WCHAR uniChar[ 2 ];
     765
     766                    lstrcpynAtoW(( LPWSTR )&uniChar, ( LPCSTR )&dbcsCh, 2 );
     767                    winMsg->wParam = ( WPARAM )uniChar[ 0 ];
     768                }
     769                // insert DBCS trail byte for Non-Unicode window
     770                else if(fMsgRemoved && !(teb->o.odin.fTranslated))
     771                {
     772                    MSG extramsg;
     773                    memcpy(&extramsg, winMsg, sizeof(MSG));
     774
     775                    //After SetFocus(0), all keystrokes are converted in WM_SYS*
     776                    extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR;
     777
     778                    extramsg.wParam = CHAR2FROMMP( os2Msg->mp2 );
     779                    extramsg.lParam = 0;
     780
     781                    setThreadQueueExtraCharMessage(teb, &extramsg);
     782                }
     783            }
     784        }
    742785        winMsg->lParam  = repeatCount & 0x0FFFF;                 // bit 0-15, repeatcount
    743786        winMsg->lParam |= (wWinScan & 0x1FF) << 16;  // bit 16-23, scancode + bit 15 extended
     
    797840            winMsg->lParam |= WIN_KEY_PREVSTATE;                    // bit 30, previous state, always 1 for a WM_KEYUP message
    798841            winMsg->lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
     842          }
     843          else if( scanCode == 0 )
     844          {
     845            //After SetFocus(0), all keystrokes are converted in WM_SYS*
     846            winMsg->message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR :  WINWM_CHAR;
    799847          }
    800848          else
Note: See TracChangeset for help on using the changeset viewer.