wrc: Add support for Unicode accelerator strings.

This commit is contained in:
Alexandre Julliard 2008-04-08 11:54:47 +02:00
parent 18828f41fe
commit cff332fbfd
1 changed files with 31 additions and 12 deletions

View File

@ -2279,9 +2279,8 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
int keycode = 0; int keycode = 0;
event_t *ev = new_event(); event_t *ev = new_event();
if(key->type != str_char) if(key->type == str_char)
yyerror("Key code must be an ascii string"); {
if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff)))
yyerror("VIRTKEY code is not equal to ascii value"); yyerror("VIRTKEY code is not equal to ascii value");
@ -2297,6 +2296,26 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
} }
else else
keycode = key->str.cstr[0]; keycode = key->str.cstr[0];
}
else
{
if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0]))
yyerror("VIRTKEY code is not equal to ascii value");
if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0)
{
yyerror("Cannot use both '^' and CONTROL modifier");
}
else if(key->str.wstr[0] == '^')
{
keycode = toupperW(key->str.wstr[1]) - '@';
if(keycode >= ' ')
yyerror("Control-code out of range");
}
else
keycode = key->str.wstr[0];
}
ev->key = keycode; ev->key = keycode;
ev->id = id; ev->id = id;
ev->flags = flags & ~WRC_AF_ASCII; ev->flags = flags & ~WRC_AF_ASCII;