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

Pass value rather than address of ch during main loop

This commit is contained in:
James Booth 2015-01-14 23:54:46 +00:00
parent ee14e8d05e
commit a6160d52c6
4 changed files with 24 additions and 24 deletions

View File

@ -118,7 +118,7 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
ch = ui_get_char(inp, &size, &result); ch = ui_get_char(inp, &size, &result);
ui_handle_special_keys(&ch, result); ui_handle_special_keys(ch, result);
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
otr_poll(); otr_poll();
#endif #endif

View File

@ -80,8 +80,8 @@ static Display *display;
static GTimer *ui_idle_time; static GTimer *ui_idle_time;
static void _win_handle_switch(const wint_t * const ch); static void _win_handle_switch(const wint_t ch);
static void _win_handle_page(const wint_t * const ch, const int result); static void _win_handle_page(const wint_t ch, const int result);
static void _win_show_history(int win_index, const char * const contact); static void _win_show_history(int win_index, const char * const contact);
static void _ui_draw_term_title(void); static void _ui_draw_term_title(void);
@ -702,11 +702,11 @@ ui_disconnected(void)
} }
void void
ui_handle_special_keys(const wint_t * const ch, const int result) ui_handle_special_keys(const wint_t ch, const int result)
{ {
_win_handle_switch(ch); _win_handle_switch(ch);
_win_handle_page(ch, result); _win_handle_page(ch, result);
if (*ch == KEY_RESIZE) { if (ch == KEY_RESIZE) {
ui_resize(); ui_resize();
} }
} }
@ -2935,33 +2935,33 @@ ui_hide_roster(void)
} }
static void static void
_win_handle_switch(const wint_t * const ch) _win_handle_switch(const wint_t ch)
{ {
if (*ch == KEY_F(1)) { if (ch == KEY_F(1)) {
ui_switch_win(1); ui_switch_win(1);
} else if (*ch == KEY_F(2)) { } else if (ch == KEY_F(2)) {
ui_switch_win(2); ui_switch_win(2);
} else if (*ch == KEY_F(3)) { } else if (ch == KEY_F(3)) {
ui_switch_win(3); ui_switch_win(3);
} else if (*ch == KEY_F(4)) { } else if (ch == KEY_F(4)) {
ui_switch_win(4); ui_switch_win(4);
} else if (*ch == KEY_F(5)) { } else if (ch == KEY_F(5)) {
ui_switch_win(5); ui_switch_win(5);
} else if (*ch == KEY_F(6)) { } else if (ch == KEY_F(6)) {
ui_switch_win(6); ui_switch_win(6);
} else if (*ch == KEY_F(7)) { } else if (ch == KEY_F(7)) {
ui_switch_win(7); ui_switch_win(7);
} else if (*ch == KEY_F(8)) { } else if (ch == KEY_F(8)) {
ui_switch_win(8); ui_switch_win(8);
} else if (*ch == KEY_F(9)) { } else if (ch == KEY_F(9)) {
ui_switch_win(9); ui_switch_win(9);
} else if (*ch == KEY_F(10)) { } else if (ch == KEY_F(10)) {
ui_switch_win(0); ui_switch_win(0);
} }
} }
static void static void
_win_handle_page(const wint_t * const ch, const int result) _win_handle_page(const wint_t ch, const int result)
{ {
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
int rows = getmaxy(stdscr); int rows = getmaxy(stdscr);
@ -2973,7 +2973,7 @@ _win_handle_page(const wint_t * const ch, const int result)
if (prefs_get_boolean(PREF_MOUSE)) { if (prefs_get_boolean(PREF_MOUSE)) {
MEVENT mouse_event; MEVENT mouse_event;
if (*ch == KEY_MOUSE) { if (ch == KEY_MOUSE) {
if (getmouse(&mouse_event) == OK) { if (getmouse(&mouse_event) == OK) {
#ifdef PLATFORM_CYGWIN #ifdef PLATFORM_CYGWIN
@ -3008,7 +3008,7 @@ _win_handle_page(const wint_t * const ch, const int result)
} }
// page up // page up
if (*ch == KEY_PPAGE) { if (ch == KEY_PPAGE) {
*page_start -= page_space; *page_start -= page_space;
// went past beginning, show first page // went past beginning, show first page
@ -3019,7 +3019,7 @@ _win_handle_page(const wint_t * const ch, const int result)
win_update_virtual(current); win_update_virtual(current);
// page down // page down
} else if (*ch == KEY_NPAGE) { } else if (ch == KEY_NPAGE) {
*page_start += page_space; *page_start += page_space;
// only got half a screen, show full screen // only got half a screen, show full screen
@ -3045,7 +3045,7 @@ _win_handle_page(const wint_t * const ch, const int result)
int *sub_y_pos = &(split_layout->sub_y_pos); int *sub_y_pos = &(split_layout->sub_y_pos);
// alt up arrow // alt up arrow
if ((result == KEY_CODE_YES) && ((*ch == 565) || (*ch == 337))) { if ((result == KEY_CODE_YES) && ((ch == 565) || (ch == 337))) {
*sub_y_pos -= page_space; *sub_y_pos -= page_space;
// went past beginning, show first page // went past beginning, show first page
@ -3055,7 +3055,7 @@ _win_handle_page(const wint_t * const ch, const int result)
win_update_virtual(current); win_update_virtual(current);
// alt down arrow // alt down arrow
} else if ((result == KEY_CODE_YES) && ((*ch == 524) || (*ch == 336))) { } else if ((result == KEY_CODE_YES) && ((ch == 524) || (ch == 336))) {
*sub_y_pos += page_space; *sub_y_pos += page_space;
// only got half a screen, show full screen // only got half a screen, show full screen

View File

@ -61,7 +61,7 @@ void ui_close(void);
void ui_redraw(void); void ui_redraw(void);
void ui_resize(void); void ui_resize(void);
GSList* ui_get_chat_recipients(void); GSList* ui_get_chat_recipients(void);
void ui_handle_special_keys(const wint_t * const ch, const int result); void ui_handle_special_keys(const wint_t ch, const int result);
gboolean ui_switch_win(const int i); gboolean ui_switch_win(const int i);
void ui_next_win(void); void ui_next_win(void);
void ui_previous_win(void); void ui_previous_win(void);

View File

@ -64,7 +64,7 @@ GSList* ui_get_chat_recipients(void)
return NULL; return NULL;
} }
void ui_handle_special_keys(const wint_t * const ch, const int result) {} void ui_handle_special_keys(const wint_t ch, const int result) {}
gboolean ui_switch_win(const int i) gboolean ui_switch_win(const int i)
{ {