mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:13:01 +01:00
remove scroll mode, scroll windows via PageUp/PageDown
This commit is contained in:
parent
f10ce94f38
commit
24a85df15f
35
src/chat.c
35
src/chat.c
@ -548,17 +548,6 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
getmaxyx(self->window, y2, x2);
|
getmaxyx(self->window, y2, x2);
|
||||||
int cur_len = 0;
|
int cur_len = 0;
|
||||||
|
|
||||||
if (!ltr && (key == T_KEY_ESC)) { /* ESC key: Toggle history scroll mode */
|
|
||||||
bool scroll = ctx->hst->scroll_mode ? false : true;
|
|
||||||
line_info_toggle_scroll(self, scroll);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we're in scroll mode ignore rest of function */
|
|
||||||
if (ctx->hst->scroll_mode) {
|
|
||||||
line_info_onKey(self, key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ltr) {
|
if (ltr) {
|
||||||
/* prevents buffer overflows and strange behaviour when cursor goes past the window */
|
/* prevents buffer overflows and strange behaviour when cursor goes past the window */
|
||||||
if ( (ctx->len < MAX_STR_SIZE - 1) && (ctx->len < (x2 * (CHATBOX_HEIGHT - 1) - 1)) ) {
|
if ( (ctx->len < MAX_STR_SIZE - 1) && (ctx->len < (x2 * (CHATBOX_HEIGHT - 1) - 1)) ) {
|
||||||
@ -574,6 +563,8 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
set_typingstatus(self, m, 1);
|
set_typingstatus(self, m, 1);
|
||||||
|
|
||||||
} else { /* if (!ltr) */
|
} else { /* if (!ltr) */
|
||||||
|
if (line_info_onKey(self, key))
|
||||||
|
return;
|
||||||
|
|
||||||
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key */
|
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key */
|
||||||
if (ctx->pos > 0) {
|
if (ctx->pos > 0) {
|
||||||
@ -746,21 +737,17 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
line_info_print(self);
|
line_info_print(self);
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
|
|
||||||
if (ctx->hst->scroll_mode) {
|
curs_set(1);
|
||||||
line_info_onDraw(self);
|
scrollok(ctx->history, 0);
|
||||||
} else {
|
|
||||||
curs_set(1);
|
|
||||||
scrollok(ctx->history, 1);
|
|
||||||
|
|
||||||
if (ctx->len > 0 && !ctx->hst->scroll_mode) {
|
if (ctx->len> 0) {
|
||||||
uint8_t line[MAX_STR_SIZE];
|
uint8_t line[MAX_STR_SIZE];
|
||||||
|
|
||||||
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
|
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
|
||||||
reset_buf(ctx);
|
reset_buf(ctx);
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
} else {
|
} else {
|
||||||
mvwprintw(ctx->linewin, 1, 0, "%s", line);
|
mvwprintw(ctx->linewin, 1, 0, "%s", line);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
for (i = 0; i < NUMLINES; ++i)
|
for (i = 0; i < NUMLINES; ++i)
|
||||||
line_info_add(self, NULL, NULL, NULL, lines[i], SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, lines[i], SYS_MSG, 0, 0);
|
||||||
|
|
||||||
msg = " * Use ESC key to toggle history scroll mode\n";
|
msg = " * Use Page Up/Page Down to scroll chat history\n";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
|
|
||||||
hst->line_start = start;
|
hst->line_start = start;
|
||||||
|
@ -147,9 +147,9 @@ static void print_groupchat_help(ToxWindow *self)
|
|||||||
for (i = 0; i < NUMLINES; ++i)
|
for (i = 0; i < NUMLINES; ++i)
|
||||||
line_info_add(self, NULL, NULL, NULL, lines[i], SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, lines[i], SYS_MSG, 0, 0);
|
||||||
|
|
||||||
msg = " * Use ESC key to toggle history scroll mode";
|
msg = " * Use Page Up/Page Down to scroll chat history";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
msg = " * Scroll peer list with the Page Up/Page Down keys.\n";
|
msg = " * Scroll peer list with the < and > keys.\n";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, CYAN);
|
||||||
msg = " * Notice, some friends will be missing names while finding peers\n";
|
msg = " * Notice, some friends will be missing names while finding peers\n";
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, 0);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 1, 0);
|
||||||
@ -383,17 +383,6 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
getmaxyx(self->window, y2, x2);
|
getmaxyx(self->window, y2, x2);
|
||||||
int cur_len = 0;
|
int cur_len = 0;
|
||||||
|
|
||||||
if (!ltr && (key == T_KEY_ESC) ) { /* ESC key: Toggle history scroll mode */
|
|
||||||
bool scroll = ctx->hst->scroll_mode ? false : true;
|
|
||||||
line_info_toggle_scroll(self, scroll);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we're in scroll mode ignore rest of function */
|
|
||||||
if (ctx->hst->scroll_mode) {
|
|
||||||
line_info_onKey(self, key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ltr) {
|
if (ltr) {
|
||||||
if ( (ctx->len < MAX_STR_SIZE - 1) && (ctx->len < (x2 * (CHATBOX_HEIGHT - 1) - 1)) ) {
|
if ( (ctx->len < MAX_STR_SIZE - 1) && (ctx->len < (x2 * (CHATBOX_HEIGHT - 1) - 1)) ) {
|
||||||
add_char_to_buf(ctx, key);
|
add_char_to_buf(ctx, key);
|
||||||
@ -405,6 +394,8 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else { /* if (!ltr) */
|
} else { /* if (!ltr) */
|
||||||
|
if (line_info_onKey(self, key))
|
||||||
|
return;
|
||||||
|
|
||||||
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */
|
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */
|
||||||
if (ctx->pos > 0) {
|
if (ctx->pos > 0) {
|
||||||
@ -521,14 +512,14 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Scroll peerlist up and down one position if list overflows window */
|
/* Scroll peerlist up and down one position if list overflows window */
|
||||||
else if (key == KEY_NPAGE) {
|
else if (key == T_KEY_C_PRD) {
|
||||||
int L = y2 - CHATBOX_HEIGHT - SDBAR_OFST;
|
int L = y2 - CHATBOX_HEIGHT - SDBAR_OFST;
|
||||||
|
|
||||||
if (groupchats[self->num].side_pos < groupchats[self->num].num_peers - L)
|
if (groupchats[self->num].side_pos < groupchats[self->num].num_peers - L)
|
||||||
++groupchats[self->num].side_pos;
|
++groupchats[self->num].side_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_PPAGE) {
|
else if (key == T_KEY_C_CMA) {
|
||||||
if (groupchats[self->num].side_pos > 0)
|
if (groupchats[self->num].side_pos > 0)
|
||||||
--groupchats[self->num].side_pos;
|
--groupchats[self->num].side_pos;
|
||||||
}
|
}
|
||||||
@ -587,21 +578,17 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
line_info_print(self);
|
line_info_print(self);
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
|
|
||||||
if (ctx->hst->scroll_mode) {
|
scrollok(ctx->history, 0);
|
||||||
line_info_onDraw(self);
|
curs_set(1);
|
||||||
} else {
|
|
||||||
scrollok(ctx->history, 1);
|
|
||||||
curs_set(1);
|
|
||||||
|
|
||||||
if (ctx->len > 0) {
|
if (ctx->len > 0) {
|
||||||
uint8_t line[MAX_STR_SIZE];
|
uint8_t line[MAX_STR_SIZE];
|
||||||
|
|
||||||
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
|
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
|
||||||
reset_buf(ctx);
|
reset_buf(ctx);
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
} else {
|
} else {
|
||||||
mvwprintw(ctx->linewin, 1, 0, "%s", line);
|
mvwprintw(ctx->linewin, 1, 0, "%s", line);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ void line_info_init(struct history *hst)
|
|||||||
hst->line_end = hst->line_start;
|
hst->line_end = hst->line_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resets line_start when scroll mode is disabled */
|
/* resets line_start */
|
||||||
static void line_info_reset_start(struct history *hst)
|
static void line_info_reset_start(struct history *hst)
|
||||||
{
|
{
|
||||||
struct line_info *line = hst->line_end;
|
struct line_info *line = hst->line_end;
|
||||||
@ -59,7 +59,7 @@ static void line_info_reset_start(struct history *hst)
|
|||||||
|
|
||||||
while (line) {
|
while (line) {
|
||||||
if (line->id == start_id) {
|
if (line->id == start_id) {
|
||||||
hst->line_start = line;
|
hst->line_start = line->next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,23 +67,6 @@ static void line_info_reset_start(struct history *hst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_info_toggle_scroll(ToxWindow *self, bool scroll)
|
|
||||||
{
|
|
||||||
WINDOW *win = self->chatwin->history;
|
|
||||||
struct history *hst = self->chatwin->hst;
|
|
||||||
|
|
||||||
if (scroll) {
|
|
||||||
hst->scroll_mode = true;
|
|
||||||
scrollok(win, 0);
|
|
||||||
curs_set(0);
|
|
||||||
} else {
|
|
||||||
hst->scroll_mode = false;
|
|
||||||
scrollok(win, 1);
|
|
||||||
curs_set(1);
|
|
||||||
line_info_reset_start(hst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void line_info_cleanup(struct history *hst)
|
void line_info_cleanup(struct history *hst)
|
||||||
{
|
{
|
||||||
struct line_info *tmp1 = hst->line_root;
|
struct line_info *tmp1 = hst->line_root;
|
||||||
@ -201,7 +184,7 @@ void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *na
|
|||||||
++hst->start_id;
|
++hst->start_id;
|
||||||
lines -= (1 + hst->line_start->len / (x2 - offst));
|
lines -= (1 + hst->line_start->len / (x2 - offst));
|
||||||
|
|
||||||
if (!hst->scroll_mode && hst->line_start->next)
|
if (hst->line_start->next)
|
||||||
hst->line_start = hst->line_start->next;
|
hst->line_start = hst->line_start->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,24 +390,26 @@ static void line_info_page_down(ToxWindow *self, struct history *hst)
|
|||||||
hst->line_start = hst->line_start->next;
|
hst->line_start = hst->line_start->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_info_onKey(ToxWindow *self, wint_t key)
|
bool line_info_onKey(ToxWindow *self, wint_t key)
|
||||||
{
|
{
|
||||||
struct history *hst = self->chatwin->hst;
|
struct history *hst = self->chatwin->hst;
|
||||||
|
bool match = true;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case KEY_PPAGE:
|
/* TODO: Find good key bindings for page up/page down scroll behaviour */
|
||||||
|
/* case KEY_SPREVIOUS:
|
||||||
line_info_page_up(self, hst);
|
line_info_page_up(self, hst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_NPAGE:
|
case KEY_SNEXT:
|
||||||
line_info_page_down(self, hst);
|
line_info_page_down(self, hst);
|
||||||
break;
|
break; */
|
||||||
|
|
||||||
case KEY_UP:
|
case KEY_PPAGE:
|
||||||
line_info_scroll_up(hst);
|
line_info_scroll_up(hst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_DOWN:
|
case KEY_NPAGE:
|
||||||
line_info_scroll_down(hst);
|
line_info_scroll_down(hst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -435,18 +420,13 @@ void line_info_onKey(ToxWindow *self, wint_t key)
|
|||||||
case KEY_END:
|
case KEY_END:
|
||||||
line_info_reset_start(hst);
|
line_info_reset_start(hst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
match = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void line_info_onDraw(ToxWindow *self)
|
return match;
|
||||||
{
|
|
||||||
ChatContext *ctx = self->chatwin;
|
|
||||||
|
|
||||||
wattron(ctx->linewin, A_BOLD | COLOR_PAIR(BLUE));
|
|
||||||
mvwprintw(ctx->linewin, 1, 0, "Scroll mode:\n");
|
|
||||||
wattroff(ctx->linewin, A_BOLD | COLOR_PAIR(BLUE));
|
|
||||||
mvwprintw(ctx->linewin, 1, 13, "Use up/down arrows, page up/page down, and home/end to navigate.\n"
|
|
||||||
" ESC to exit.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_info_clear(struct history *hst)
|
void line_info_clear(struct history *hst)
|
||||||
|
@ -61,7 +61,6 @@ struct history {
|
|||||||
struct line_info *line_end;
|
struct line_info *line_end;
|
||||||
uint32_t start_id; /* keeps track of where line_start should be when at bottom of history */
|
uint32_t start_id; /* keeps track of where line_start should be when at bottom of history */
|
||||||
uint32_t line_items;
|
uint32_t line_items;
|
||||||
bool scroll_mode;
|
|
||||||
|
|
||||||
/* keeps track of lines added between window refreshes */
|
/* keeps track of lines added between window refreshes */
|
||||||
uint32_t queue;
|
uint32_t queue;
|
||||||
@ -78,9 +77,6 @@ void line_info_print(ToxWindow *self);
|
|||||||
/* frees all history lines */
|
/* frees all history lines */
|
||||||
void line_info_cleanup(struct history *hst);
|
void line_info_cleanup(struct history *hst);
|
||||||
|
|
||||||
/* Toggles scroll mode for current window */
|
|
||||||
void line_info_toggle_scroll(ToxWindow *self, bool scroll);
|
|
||||||
|
|
||||||
/* clears the screen (does not delete anything) */
|
/* clears the screen (does not delete anything) */
|
||||||
void line_info_clear(struct history *hst);
|
void line_info_clear(struct history *hst);
|
||||||
|
|
||||||
@ -88,7 +84,6 @@ void line_info_clear(struct history *hst);
|
|||||||
void line_info_set(ToxWindow *self, uint32_t id, uint8_t *msg);
|
void line_info_set(ToxWindow *self, uint32_t id, uint8_t *msg);
|
||||||
|
|
||||||
void line_info_init(struct history *hst);
|
void line_info_init(struct history *hst);
|
||||||
void line_info_onKey(ToxWindow *self, wint_t key);
|
bool line_info_onKey(ToxWindow *self, wint_t key); /* returns true if key is a match */
|
||||||
void line_info_onDraw(ToxWindow *self);
|
|
||||||
|
|
||||||
#endif /* #define _line_info_h */
|
#endif /* #define _line_info_h */
|
||||||
|
@ -64,11 +64,10 @@ void get_time_str(uint8_t *buf)
|
|||||||
strftime(buf, TIME_STR_SIZE, t, get_time());
|
strftime(buf, TIME_STR_SIZE, t, get_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: FIX */
|
char *hex_string_to_bin(const char *hex_string)
|
||||||
unsigned char *hex_string_to_bin(char hex_string[])
|
|
||||||
{
|
{
|
||||||
size_t len = strlen(hex_string);
|
size_t len = strlen(hex_string);
|
||||||
unsigned char *val = malloc(len);
|
char *val = malloc(len);
|
||||||
|
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
endwin();
|
endwin();
|
||||||
@ -76,11 +75,10 @@ unsigned char *hex_string_to_bin(char hex_string[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pos = hex_string;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < len; ++i, pos += 2)
|
for (i = 0; i < len; ++i, hex_string += 2)
|
||||||
sscanf(pos, "%2hhx", &val[i]);
|
sscanf(hex_string, "%2hhx", &val[i]);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
/* convert a hex string to binary */
|
/* convert a hex string to binary */
|
||||||
unsigned char *hex_string_to_bin(char hex_string[]);
|
char *hex_string_to_bin(const char *hex_string);
|
||||||
|
|
||||||
/* get the current unix time */
|
/* get the current unix time */
|
||||||
uint64_t get_unix_time(void);
|
uint64_t get_unix_time(void);
|
||||||
|
21
src/prompt.c
21
src/prompt.c
@ -131,21 +131,6 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
getyx(ctx->history, y, x);
|
getyx(ctx->history, y, x);
|
||||||
getmaxyx(ctx->history, y2, x2);
|
getmaxyx(ctx->history, y2, x2);
|
||||||
|
|
||||||
/* TODO this is buggy */
|
|
||||||
/* ESC key: Toggle history scroll mode */
|
|
||||||
/*
|
|
||||||
if (key == T_KEY_ESC) {
|
|
||||||
bool scroll = ctx->hst->scroll_mode ? false : true;
|
|
||||||
line_info_toggle_scroll(self, scroll);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* If we're in scroll mode ignore rest of function */
|
|
||||||
if (ctx->hst->scroll_mode) {
|
|
||||||
line_info_onKey(self, key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ltr) {
|
if (ltr) {
|
||||||
if (ctx->len < (MAX_STR_SIZE - 1)) {
|
if (ctx->len < (MAX_STR_SIZE - 1)) {
|
||||||
add_char_to_buf(ctx, key);
|
add_char_to_buf(ctx, key);
|
||||||
@ -273,10 +258,8 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
getyx(ctx->history, y, x);
|
getyx(ctx->history, y, x);
|
||||||
getmaxyx(ctx->history, y2, x2);
|
getmaxyx(ctx->history, y2, x2);
|
||||||
|
|
||||||
if (!ctx->hst->scroll_mode) {
|
curs_set(1);
|
||||||
curs_set(1);
|
scrollok(ctx->history, 1);
|
||||||
scrollok(ctx->history, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
line_info_print(self);
|
line_info_print(self);
|
||||||
|
|
||||||
|
12
src/toxic.c
12
src/toxic.c
@ -84,12 +84,6 @@ struct arg_opts {
|
|||||||
struct _Winthread Winthread;
|
struct _Winthread Winthread;
|
||||||
struct user_settings *user_settings = NULL;
|
struct user_settings *user_settings = NULL;
|
||||||
|
|
||||||
void on_window_resize(int sig)
|
|
||||||
{
|
|
||||||
refresh();
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_term(void)
|
static void init_term(void)
|
||||||
{
|
{
|
||||||
signal(SIGWINCH, on_window_resize);
|
signal(SIGWINCH, on_window_resize);
|
||||||
@ -208,9 +202,9 @@ static int nodelist_load(char *filename)
|
|||||||
|
|
||||||
while (fgets(line, sizeof(line), fp) && linecnt < MAXNODES) {
|
while (fgets(line, sizeof(line), fp) && linecnt < MAXNODES) {
|
||||||
if (strlen(line) > MINLINE) {
|
if (strlen(line) > MINLINE) {
|
||||||
char *name = strtok(line, " ");
|
const char *name = strtok(line, " ");
|
||||||
char *port = strtok(NULL, " ");
|
const char *port = strtok(NULL, " ");
|
||||||
char *key_ascii = strtok(NULL, " ");
|
const char *key_ascii = strtok(NULL, " ");
|
||||||
|
|
||||||
/* invalid line */
|
/* invalid line */
|
||||||
if (name == NULL || port == NULL || key_ascii == NULL)
|
if (name == NULL || port == NULL || key_ascii == NULL)
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
#define T_KEY_C_E 0x05 /* ctrl-e */
|
#define T_KEY_C_E 0x05 /* ctrl-e */
|
||||||
#define T_KEY_C_A 0x01 /* ctrl-a */
|
#define T_KEY_C_A 0x01 /* ctrl-a */
|
||||||
#define T_KEY_ESC 0x1B /* ESC key */
|
#define T_KEY_ESC 0x1B /* ESC key */
|
||||||
|
#define T_KEY_C_CMA 0x2C /* ctrl-comma */
|
||||||
|
#define T_KEY_C_PRD 0x2E /* ctrl-period */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MOVE_UP,
|
MOVE_UP,
|
||||||
|
@ -316,6 +316,12 @@ ToxWindow *init_windows(Tox *m)
|
|||||||
return prompt;
|
return prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void on_window_resize(int sig)
|
||||||
|
{
|
||||||
|
refresh();
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
static void draw_window_tab(ToxWindow toxwin)
|
static void draw_window_tab(ToxWindow toxwin)
|
||||||
{
|
{
|
||||||
/* alert0 takes priority */
|
/* alert0 takes priority */
|
||||||
|
@ -176,5 +176,6 @@ void del_window(ToxWindow *w);
|
|||||||
void set_active_window(int ch);
|
void set_active_window(int ch);
|
||||||
int get_num_active_windows(void);
|
int get_num_active_windows(void);
|
||||||
void kill_all_windows(void); /* should only be called on shutdown */
|
void kill_all_windows(void); /* should only be called on shutdown */
|
||||||
|
void on_window_resize(int sig);
|
||||||
|
|
||||||
#endif /* #define _windows_h */
|
#endif /* #define _windows_h */
|
||||||
|
Loading…
Reference in New Issue
Block a user