Re: [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. €.

I don't know this part of Allegro at all really, so maybe the answer is 
obvious, but just looking at the patch itself:

+   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];
    }

What would happen in Windows 98 if n is not 1? Is the value of unicode 
undefined in that case? Or is it never used if n is not 1 (the second part 
of code suggests that it would)? Or should it be n != 1 in the first case?

Evert




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