Moved resize code to windows.c, reorder main loop
This commit is contained in:
@@ -87,9 +87,6 @@ void inp_get_char(int *ch, char *input, int *size)
|
||||
noecho();
|
||||
*ch = wgetch(inp_win);
|
||||
|
||||
if (*ch == KEY_RESIZE) {
|
||||
win_resize();
|
||||
} else {
|
||||
// if it wasn't an arrow key etc
|
||||
if (!_handle_edit(*ch, input, size)) {
|
||||
if (_printable(*ch)) {
|
||||
@@ -115,7 +112,6 @@ void inp_get_char(int *ch, char *input, int *size)
|
||||
reset_search_attempts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo();
|
||||
}
|
||||
@@ -254,7 +250,7 @@ static int _printable(const int ch)
|
||||
ch != KEY_F(4) && ch != KEY_F(5) && ch != KEY_F(6) &&
|
||||
ch != KEY_F(7) && ch != KEY_F(8) && ch != KEY_F(9) &&
|
||||
ch != KEY_F(10) && ch!= KEY_F(11) && ch != KEY_F(12) &&
|
||||
ch != KEY_IC && ch != KEY_EIC);
|
||||
ch != KEY_IC && ch != KEY_EIC && ch != KEY_RESIZE);
|
||||
}
|
||||
|
||||
static void _replace_input(char *input, const char * const new_input, int *size)
|
||||
|
||||
@@ -47,8 +47,8 @@ void profanity_run(void)
|
||||
while(ch != '\n') {
|
||||
gui_refresh();
|
||||
jabber_process_events();
|
||||
win_handle_special_keys(&ch);
|
||||
inp_get_char(&ch, inp, &size);
|
||||
win_handle_special_keys(&ch);
|
||||
}
|
||||
|
||||
inp[size++] = '\0';
|
||||
|
||||
22
windows.c
22
windows.c
@@ -57,6 +57,7 @@ static void _cons_show_incoming_message(const char * const short_from,
|
||||
const int win_index);
|
||||
static void _win_handle_switch(const int * const ch);
|
||||
static void _win_handle_page(const int * const ch);
|
||||
static void _win_handle_resize(const int * const ch);
|
||||
|
||||
void gui_init(void)
|
||||
{
|
||||
@@ -88,15 +89,6 @@ void gui_init(void)
|
||||
dirty = TRUE;
|
||||
}
|
||||
|
||||
void win_resize(void)
|
||||
{
|
||||
create_title_bar();
|
||||
create_status_bar();
|
||||
create_input_window();
|
||||
_current_window_refresh();
|
||||
dirty = TRUE;
|
||||
}
|
||||
|
||||
void gui_refresh(void)
|
||||
{
|
||||
title_bar_refresh();
|
||||
@@ -325,6 +317,7 @@ void win_handle_special_keys(const int * const ch)
|
||||
{
|
||||
_win_handle_switch(ch);
|
||||
_win_handle_page(ch);
|
||||
_win_handle_resize(ch);
|
||||
}
|
||||
|
||||
void win_page_off(void)
|
||||
@@ -521,6 +514,17 @@ static void _win_handle_switch(const int * const ch)
|
||||
}
|
||||
}
|
||||
|
||||
static void _win_handle_resize(const int * const ch)
|
||||
{
|
||||
if (*ch == KEY_RESIZE) {
|
||||
create_title_bar();
|
||||
create_status_bar();
|
||||
create_input_window();
|
||||
_current_window_refresh();
|
||||
dirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void _win_handle_page(const int * const ch)
|
||||
{
|
||||
int rows, cols, y, x;
|
||||
|
||||
Reference in New Issue
Block a user