Alexandre Julliard : wrc: Fix parsing of virtkey accelerators.

Alexandre Julliard julliard at winehq.org
Mon Jan 30 14:05:53 CST 2012


Module: wine
Branch: master
Commit: 811da88cfcd86a7f6da9ba7d3e0f23e9fdeb2660
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=811da88cfcd86a7f6da9ba7d3e0f23e9fdeb2660

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 30 12:12:19 2012 +0100

wrc: Fix parsing of virtkey accelerators.

---

 tools/wrc/genres.c |    2 ++
 tools/wrc/parser.y |   43 -------------------------------------------
 2 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/tools/wrc/genres.c b/tools/wrc/genres.c
index edf4823..e49d8a5 100644
--- a/tools/wrc/genres.c
+++ b/tools/wrc/genres.c
@@ -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')))
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index efcc050..4cc37ac 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -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;




More information about the wine-cvs mailing list