This should get Abi up and running again on Windows 95.  Thanks for
the tips guys.  It also contains a fix for a unicode keymap bug I
accidentally introduced a few days ago.

Andrew Dunbar.

-- 
http://linguaphile.sourceforge.net
Index: src/af/ev/win/ev_Win32Keyboard.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Keyboard.cpp,v
retrieving revision 1.26
diff -u -r1.26 ev_Win32Keyboard.cpp
--- src/af/ev/win/ev_Win32Keyboard.cpp  2001/06/11 12:23:27     1.26
+++ src/af/ev/win/ev_Win32Keyboard.cpp  2001/06/14 14:28:01
@@ -165,11 +165,19 @@
 /*****************************************************************/
 
 ev_Win32Keyboard::ev_Win32Keyboard(EV_EditEventMapper * pEEM)
-       : EV_Keyboard(pEEM)
+       : EV_Keyboard(pEEM),
+         m_hKeyboardLayout(0),
+         m_iconv((UT_iconv_t)-1),
+         m_bIsUnicodeInput(false)
 {
-       m_hKeyboardLayout = 0;
-       m_iconv = (UT_iconv_t)-1;
-       m_bIsUnicodeInput = false;
+       HINSTANCE hInstUser;
+       if (hInstUser = LoadLibrary("USER32.DLL"))
+       {
+               m_pToUnicodeEx = reinterpret_cast<int (*)(UINT,UINT,CONST 
+PBYTE,LPWSTR,int,UINT,HKL)>
+                       (GetProcAddress(hInstUser, "ToUnicodeEx"));
+               FreeLibrary(hInstUser);
+       }
+       
        remapKeyboard(GetKeyboardLayout(0));
 }
 
@@ -561,7 +569,7 @@
        }
 
        EV_EditMethod * pEM;
-       EV_EditEventMapperResult result = m_pEEM->Keystroke(EV_EKP_PRESS|ems|b,&pEM);
+       EV_EditEventMapperResult result = 
+m_pEEM->Keystroke(EV_EKP_PRESS|ems|charData[0],&pEM);
 
        switch (result)
        {
@@ -648,7 +656,10 @@
                                                                           LPWSTR 
pwszBuff, int cchBuff)
 {
        if (m_bIsUnicodeInput)
-               return 
ToUnicodeEx(nVirtKey,wScanCode,lpKeyState,pwszBuff,cchBuff,0,m_hKeyboardLayout);
+       {
+               UT_ASSERT(m_pToUnicodeEx);
+               return 
+(*m_pToUnicodeEx)(nVirtKey,wScanCode,lpKeyState,pwszBuff,cchBuff,0,m_hKeyboardLayout);
+       }
        else
                return 
ToAsciiEx(nVirtKey,wScanCode,lpKeyState,pwszBuff,0,m_hKeyboardLayout);
 };
Index: src/af/ev/win/ev_Win32Keyboard.h
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Keyboard.h,v
retrieving revision 1.15
diff -u -r1.15 ev_Win32Keyboard.h
--- src/af/ev/win/ev_Win32Keyboard.h    2001/06/01 18:05:18     1.15
+++ src/af/ev/win/ev_Win32Keyboard.h    2001/06/14 14:28:02
@@ -52,6 +52,10 @@
                                                                  WCHAR b, 
EV_EditModifierState ems);
        int                                     _scanCodeToChars(UINT nVirtKey, UINT 
wScanCode,
                                                                                 CONST 
PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff);
+
+       int                                     (*m_pToUnicodeEx)(UINT wVirtKey, UINT 
+wScanCode,
+                                                                                 
+CONST PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff,
+                                                                                 UINT 
+wFlags, HKL dwhkl);
        HKL                                     m_hKeyboardLayout;
        UT_iconv_t                      m_iconv; /* Selected translation to Unicode */
        bool                            m_bIsUnicodeInput;
Index: src/af/xap/win/xap_Win32EncodingManager.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32EncodingManager.cpp,v
retrieving revision 1.5
diff -u -r1.5 xap_Win32EncodingManager.cpp
--- src/af/xap/win/xap_Win32EncodingManager.cpp 2001/06/11 12:23:39     1.5
+++ src/af/xap/win/xap_Win32EncodingManager.cpp 2001/06/14 14:28:13
@@ -55,6 +55,8 @@
        LanguageISOName = "en";
        LanguageISOTerritory = NULL;
 
+       XAP_EncodingManager::initialize();
+
        // Unicode Encoding Name
        // TODO Does NT use UCS-2BE internally on non-Intel CPUs?
        NativeUnicodeEncodingName = getUCS2LEName();
@@ -91,7 +93,6 @@
                LanguageISOTerritory = szTerritory;
        }
 
-       XAP_EncodingManager::initialize();
        describe();
 };
 

Reply via email to