Improving keyboard handling, including accelerator keys in dialog
boxes. Also fixes enter key in Agent32 edit box.
diff --git a/controls/menu.c b/controls/menu.c
index 1cbb1c4..abefac9 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -566,8 +566,13 @@
{
if (item->text && (IS_STRING_ITEM(item->fType)))
{
- char *p = strchr( item->text, '&' );
- if (p && (p[1] != '&') && (toupper(p[1]) == key)) return i;
+ char *p = item->text - 2;
+ do
+ {
+ p = strchr (p + 2, '&');
+ }
+ while (p != NULL && p [1] == '&');
+ if (p && (toupper(p[1]) == key)) return i;
}
}
}
@@ -2364,11 +2369,6 @@
MENU_KeyRight( &mt );
break;
- case VK_SPACE:
- case VK_RETURN:
- fEndMenu |= !MENU_ExecFocusedItem( &mt, mt.hCurrentMenu );
- break;
-
case VK_ESCAPE:
fEndMenu = TRUE;
break;
@@ -2392,6 +2392,12 @@
{
UINT32 pos;
+ if (msg.wParam == '\r' || msg.wParam == ' ')
+ {
+ fEndMenu |= !MENU_ExecFocusedItem( &mt, mt.hCurrentMenu );
+ break;
+ }
+
/* Hack to avoid control chars. */
/* We will find a better way real soon... */
if ((msg.wParam <= 32) || (msg.wParam >= 127)) break;