Commit 811da88c authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Fix parsing of virtkey accelerators.

parent c4fb5b89
......@@ -282,6 +282,7 @@ static int parse_accel_string( const string_t *key, int flags )
if(key->type == str_char)
{
if (key->str.cstr[0] == '#') return 0; /* ignore message contexts */
if((flags & WRC_AF_VIRTKEY) &&
!((key->str.cstr[0] >= 'A' && key->str.cstr[0] <= 'Z') ||
(key->str.cstr[0] >= '0' && key->str.cstr[0] <= '9')))
......@@ -309,6 +310,7 @@ static int parse_accel_string( const string_t *key, int flags )
}
else
{
if (key->str.wstr[0] == '#') return 0; /* ignore message contexts */
if((flags & WRC_AF_VIRTKEY) &&
!((key->str.wstr[0] >= 'A' && key->str.wstr[0] <= 'Z') ||
(key->str.wstr[0] >= '0' && key->str.wstr[0] <= '9')))
......
......@@ -2175,52 +2175,9 @@ static event_t *add_event(int key, int id, int flags, event_t *prev)
static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev)
{
int keycode = 0;
event_t *ev = new_event();
if(key->type == str_char)
{
if((flags & WRC_AF_VIRTKEY) &&
!((key->str.cstr[0] >= 'A' && key->str.cstr[0] <= 'Z') ||
(key->str.cstr[0] >= '0' && key->str.cstr[0] <= '9')))
yyerror("VIRTKEY code is not equal to ascii value");
if(key->str.cstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0)
{
yyerror("Cannot use both '^' and CONTROL modifier");
}
else if(key->str.cstr[0] == '^')
{
keycode = toupper((unsigned char)key->str.cstr[1]) - '@';
if(keycode >= ' ')
yyerror("Control-code out of range");
}
else
keycode = key->str.cstr[0];
}
else
{
if((flags & WRC_AF_VIRTKEY) &&
!((key->str.wstr[0] >= 'A' && key->str.wstr[0] <= 'Z') ||
(key->str.wstr[0] >= '0' && key->str.wstr[0] <= '9')))
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->str = key;
ev->key = keycode;
ev->id = id;
ev->flags = flags & ~WRC_AF_ASCII;
ev->prev = prev;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment