1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Process special keys out of loop

This commit is contained in:
James Booth 2012-02-12 22:53:53 +00:00
parent 632528a9e3
commit fc99e686fd

View File

@ -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);
}
}