From fbd84630ac956ac0b83bf02575c3acdd7f8e95f1 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Fri, 28 Jul 2006 15:49:51 +0300 Subject: [PATCH] terminal: Move kbd_timeout below set_kbd_event. This ought to make the diff of the next commit more readable. --- src/terminal/kbd.c | 51 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index a88761d26..1f9f370e7 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -621,32 +621,6 @@ free_and_return: } -static void -kbd_timeout(struct itrm *itrm) -{ - struct term_event ev; - - itrm->timer = TIMER_ID_UNDEF; - - assertm(itrm->in.queue.len, "timeout on empty queue"); - assert(!itrm->blocked); /* block_itrm should have killed itrm->timer */ - if_assert_failed return; - - if (can_read(itrm->in.std)) { - in_kbd(itrm); - return; - } - - set_kbd_term_event(&ev, KBD_ESC, KBD_MOD_NONE); - itrm_queue_event(itrm, (char *) &ev, sizeof(ev)); - - if (--itrm->in.queue.len) - memmove(itrm->in.queue.data, itrm->in.queue.data + 1, itrm->in.queue.len); - - while (process_queue(itrm)); -} - - /* Returns the length of the escape sequence */ static inline int get_esc_code(unsigned char *str, int len, unsigned char *code, int *num) @@ -836,6 +810,31 @@ set_kbd_event(struct term_event *ev, int key, int modifier) set_kbd_term_event(ev, key, modifier); } +static void +kbd_timeout(struct itrm *itrm) +{ + struct term_event ev; + + itrm->timer = TIMER_ID_UNDEF; + + assertm(itrm->in.queue.len, "timeout on empty queue"); + assert(!itrm->blocked); /* block_itrm should have killed itrm->timer */ + if_assert_failed return; + + if (can_read(itrm->in.std)) { + in_kbd(itrm); + return; + } + + set_kbd_term_event(&ev, KBD_ESC, KBD_MOD_NONE); + itrm_queue_event(itrm, (char *) &ev, sizeof(ev)); + + if (--itrm->in.queue.len) + memmove(itrm->in.queue.data, itrm->in.queue.data + 1, itrm->in.queue.len); + + while (process_queue(itrm)); +} + /* I feeeeeel the neeeed ... to rewrite this ... --pasky */ /* Just Do it ! --Zas */ /* Parse one event from itrm->in.queue and append to itrm->out.queue.