* dialog.c (dlg_key_event): Simplify logic, return void.

This commit is contained in:
Pavel Roskin 2003-10-25 00:22:13 +00:00
parent db8db1268c
commit 26328c7af6
2 changed files with 33 additions and 32 deletions

View File

@ -1,5 +1,7 @@
2003-10-24 Pavel Roskin <proski@gnu.org> 2003-10-24 Pavel Roskin <proski@gnu.org>
* dialog.c (dlg_key_event): Simplify logic, return void.
* dialog.c: Remove duplication between two chains of dialogs. * dialog.c: Remove duplication between two chains of dialogs.
* dialog.h (struct Dlg_head): Add "fullscreen" field, remove * dialog.h (struct Dlg_head): Add "fullscreen" field, remove
"refresh_pushed", rename "previous_dialog" to "parent". "refresh_pushed", rename "previous_dialog" to "parent".

View File

@ -624,48 +624,47 @@ dlg_try_hotkey (Dlg_head *h, int d_key)
return handled; return handled;
} }
static int static void
dlg_key_event (Dlg_head *h, int d_key) dlg_key_event (Dlg_head *h, int d_key)
{ {
int handled; int handled;
if (!h->current) if (!h->current)
return 0; return;
/* TAB used to cycle */ /* TAB used to cycle */
if (!(h->flags & DLG_WANT_TAB) if (!(h->flags & DLG_WANT_TAB)) {
&& (d_key == '\t' || d_key == KEY_BTAB)) { if (d_key == '\t') {
if (d_key == '\t')
dlg_one_down (h); dlg_one_down (h);
else return;
} else if (d_key == KEY_BTAB) {
dlg_one_up (h); dlg_one_up (h);
} else { return;
}
/* first can dlg_callback handle the key */
handled = (*h->callback) (h, DLG_KEY, d_key);
/* next try the hotkey */
if (!handled)
handled = dlg_try_hotkey (h, d_key);
if (handled)
(*h->callback) (h, DLG_HOTKEY_HANDLED, 0);
/* not used - then try widget_callback */
if (!handled)
handled = callback (h) (h->current, WIDGET_KEY, d_key);
/* not used- try to use the unhandled case */
if (!handled)
handled = (*h->callback) (h, DLG_UNHANDLED_KEY, d_key);
if (!handled)
dialog_handle_key (h, d_key);
(*h->callback) (h, DLG_POST_KEY, d_key);
return handled;
} }
return 1;
/* first can dlg_callback handle the key */
handled = (*h->callback) (h, DLG_KEY, d_key);
/* next try the hotkey */
if (!handled)
handled = dlg_try_hotkey (h, d_key);
if (handled)
(*h->callback) (h, DLG_HOTKEY_HANDLED, 0);
/* not used - then try widget_callback */
if (!handled)
handled = callback (h) (h->current, WIDGET_KEY, d_key);
/* not used- try to use the unhandled case */
if (!handled)
handled = (*h->callback) (h, DLG_UNHANDLED_KEY, d_key);
if (!handled)
dialog_handle_key (h, d_key);
(*h->callback) (h, DLG_POST_KEY, d_key);
} }
static inline int static inline int