From 8a882916fb35d3bbea0268f814b38d12c1f58c31 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Wed, 8 Oct 2014 15:22:49 -0400 Subject: [PATCH] fix setting custom keybinding --- src/input.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/input.c b/src/input.c index 644b010..0024455 100644 --- a/src/input.c +++ b/src/input.c @@ -33,6 +33,9 @@ #include "line_info.h" #include "notify.h" #include "groupchat.h" +#include "settings.h" + +extern struct user_settings *user_settings; /* add a char to input field and buffer */ void input_new_char(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y) @@ -256,18 +259,22 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y) force_refresh(self->chatwin->history); break; - case T_KEY_C_B: - if (self->is_groupchat) { - self->show_peerlist ^= 1; - redraw_groupchat_win(self); - } - - break; - default: match = false; break; } + /* TODO: this special case is ugly. + maybe convert entire function to if/else and make them all customizable keys? */ + if (!match && key == user_settings->key_toggle_peerlist) { + if (self->is_groupchat) { + self->show_peerlist ^= 1; + redraw_groupchat_win(self); + } + + match = true; + } + + return match; }