[AD] Re: [AL] Allegro 4.2.0 beta1 released!

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Ok, attached is the patch. Cross-posting to [AD], so Evert and
possibly others see it. I can't test myself in win98, so need to wait
until someone tests this. In XP, the ToAscii version as well as the
ToUnicode version now report unicode characters, e.g. €.

HHDG: If you want to test the new version, tell me if you need the
complete file instead of just the patch, and I can send it to you.
--- C:\Dokumente und Einstellungen\root\Lokale Einstellungen\Temp\TCV61.tmp\wkeybd.1.29.c	Mon Mar 28 23:25:09 2005
+++ C:\Dokumente und Einstellungen\root\Eigene Dateien\prog\allegro-cvs\src\win\wkeybd.c	Mon Apr 04 19:33:13 2005
@@ -256,13 +256,23 @@
          vkey = VK_RETURN;
    }
 
-   /* Nice, seems Windows has a function to just get the unicode character. */
-   n = ToUnicode(vkey, scancode, keystate, chars, sizeof chars, 0);
-   if (n == 1)
-   {
+   if (os_type == OSTYPE_WIN95 || os_type == OSTYPE_WIN98) {
+      /* Seems, this actually works for 95 and 98.  */
+      n = ToAscii(vkey, scancode, keystate, (WORD *)chars, 0);
+      if (n == 1)
+      {
+         WCHAR wstr[2];
+         MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR)chars, n, wstr, sizeof wstr);
+         unicode = wstr[0];
+      }
+   }
+   else {
+      /* Nice, seems Windows XP has a function to just get the unicode character. */
+      n = ToUnicode(vkey, scancode, keystate, chars, sizeof chars, 0);
       unicode = chars[0];
    }
-   else
+
+   if (n != 1)
    {
       /* Don't generate key presses for modifier keys. */
       if (mycode >= KEY_MODIFIERS)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/