[AD] Animation method dialog in demo cannot be cancelled with return key |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Allegro developers mailing list <alleg-developers@xxxxxxxxxx>
- Subject: [AD] Animation method dialog in demo cannot be cancelled with return key
- From: Grzegorz Adam Hankiewicz <gradha@xxxxxxxxxx>
- Date: Sat, 15 Oct 2005 23:03:28 +0200
In the demo if you select the cancel button with the keys in the
animation method dialog and press return, the game keeps going,
because return is assigned as a shortcut key to the ok button.
The following patch corrects this behaviour. However, the same
problem exists for the vsync checkbox, so at this point I leave it
to the GUI gurus, because the changes don't seem very contained.
Index: src/gui.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/gui.c,v
retrieving revision 1.81
diff -u -p -r1.81 gui.c
--- src/gui.c 21 Aug 2005 16:23:28 -0000 1.81
+++ src/gui.c 15 Oct 2005 20:57:57 -0000
@@ -1266,11 +1266,11 @@ int update_dialog(DIALOG_PLAYER *player)
/* let object deal with the key */
if (player->focus_obj >= 0) {
MESSAGE(player->focus_obj, MSG_CHAR, ccombo);
- if (player->res & D_USED_CHAR)
+ if (player->res & (D_USED_CHAR | D_CLOSE))
goto getout;
MESSAGE(player->focus_obj, MSG_UCHAR, cascii);
- if (player->res & D_USED_CHAR)
+ if (player->res & (D_USED_CHAR | D_CLOSE))
goto getout;
}
Index: src/guiproc.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/guiproc.c,v
retrieving revision 1.31
diff -u -p -r1.31 guiproc.c
--- src/guiproc.c 14 Sep 2005 11:19:42 -0000 1.31
+++ src/guiproc.c 15 Oct 2005 20:57:58 -0000
@@ -352,6 +352,11 @@ int d_button_proc(int msg, DIALOG *d, in
case MSG_WANTFOCUS:
return D_WANTFOCUS;
+ case MSG_CHAR:
+ /* Accept return key to close dalogs. */
+ if ((c & 0xFF) != 13)
+ return D_O_K;
+
case MSG_KEY:
/* close dialog? */
if (d->flags & D_EXIT) {