diff options
author | James Booth <boothj5@gmail.com> | 2012-02-12 22:53:53 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-02-12 22:53:53 +0000 |
commit | fc99e686fd46f20def60485d60a1aedd3a0710bc (patch) | |
tree | 526c9139994caad1b05e6d1236aac9b3bbcda25f | |
parent | 632528a9e3244fad9d4e1d31cf278f6c71917126 (diff) | |
download | profani-tty-fc99e686fd46f20def60485d60a1aedd3a0710bc.tar.gz |
Process special keys out of loop
-rw-r--r-- | profanity.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/profanity.c b/profanity.c index b2d8adcb..d27e5fe1 100644 --- a/profanity.c +++ b/profanity.c @@ -11,6 +11,7 @@ static void _profanity_main(void); static void _profanity_event_loop(int *ch, char *cmd, int *size); +static void _process_special_keys(int *ch); void profanity_start(void) { @@ -53,13 +54,23 @@ static void _profanity_event_loop(int *ch, char *cmd, int *size) { usleep(1); + // refresh gui title_bar_refresh(); status_bar_refresh(); - // handle incoming messages + // handle XMPP events jabber_process_events(); - // determine if they changed windows + // deal with special keys + _process_special_keys(ch); + + // try for another character on input + inp_poll_char(ch, cmd, size); +} + +static void _process_special_keys(int *ch) +{ + // change window if (*ch == KEY_F(1)) { if (win_is_active(0)) win_switch_to(0); @@ -91,7 +102,4 @@ static void _profanity_event_loop(int *ch, char *cmd, int *size) if (win_is_active(9)) win_switch_to(9); } - - // get another character from the command box - inp_poll_char(ch, cmd, size); -} +} |