Re: [AD] key scan codes have changed? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] key scan codes have changed?
- From: Elias Pschernig <allefant@xxxxxxxxxx>
- Date: Wed, 27 Apr 2005 14:19:09 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=q+QrE/fPm1dgbOJEWJi2s7K86aExZJ7Ik1bhrQx5T5sRjo/sd/qcQsIk1O/IsKZTnAPTi7uX0W4k0HJJA1Tmjz41gYXAj4hI182U5H8L1OMqGB/4kyMFxFt1abN4zI16n6+vphUelZFwLWYw+1LHcH4cX7Uihok9GgJr4ZDveZI=
Ok, see attached patch.
Index: src/win/wkeybd.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wkeybd.c,v
retrieving revision 1.32
diff -u -p -r1.32 wkeybd.c
--- src/win/wkeybd.c 8 Apr 2005 16:08:04 -0000 1.32
+++ src/win/wkeybd.c 27 Apr 2005 12:18:05 -0000
@@ -256,8 +256,8 @@ static void handle_key_press(unsigned ch
vkey = VK_RETURN;
}
- /* TODO: is there an advantage using this? maybe it would allow chinese and so on
- * characters? For now, always ToAscii is used. */
+ /* TODO: is there an advantage using ToUnicode? maybe it would allow
+ * Chinese and so on characters? For now, always ToAscii is used. */
//n = ToUnicode(vkey, scancode, keystate, chars, 16, 0);
n = ToAscii(vkey, scancode, keystate, (WORD *)chars, 0);
if (n == 1)
@@ -268,11 +268,16 @@ static void handle_key_press(unsigned ch
}
else
{
- /* Don't generate key presses for modifier keys. */
+ /* Don't generate key presses for modifier keys or dead keys */
if (mycode >= KEY_MODIFIERS || n != 0)
- unicode = -1;
+ unicode = -1;
else
- unicode = 0;
+ unicode = 0;
+ }
+
+ /* When alt key is pressed, any key always must return ASCII 0 in Allegro. */
+ if (unicode > 0 && (keystate[VK_LMENU] & 0x80)) {
+ unicode = 0;
}
_handle_key_press(unicode, mycode);