mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-24 00:13:24 +01:00
fix chat scroll bug
This commit is contained in:
parent
ab1c97fb2b
commit
d65d0a08aa
@ -209,6 +209,10 @@ void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *na
|
||||
void line_info_print(ToxWindow *self)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
if (ctx == NULL)
|
||||
return;
|
||||
|
||||
WINDOW *win = ctx->history;
|
||||
|
||||
ctx->hst->queue = 0;
|
||||
|
@ -453,8 +453,10 @@ void *thread_winref(void *data)
|
||||
{
|
||||
Tox *m = (Tox *) data;
|
||||
|
||||
while (true)
|
||||
while (true) {
|
||||
draw_active_window(m);
|
||||
refresh_inactive_windows();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -417,7 +417,7 @@ void draw_active_window(Tox *m)
|
||||
ltr = isprint(ch);
|
||||
#endif
|
||||
|
||||
if (!ltr && (ch == T_KEY_NEXT || ch == T_KEY_PREV) ) {
|
||||
if (!ltr && (ch == T_KEY_NEXT || ch == T_KEY_PREV)) {
|
||||
set_next_window((int) ch);
|
||||
} else {
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
@ -426,6 +426,22 @@ void draw_active_window(Tox *m)
|
||||
}
|
||||
}
|
||||
|
||||
/* refresh inactive windows to prevent scrolling bugs.
|
||||
call at least once per second */
|
||||
void refresh_inactive_windows(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
ToxWindow *a = &windows[i];
|
||||
|
||||
if (!a->active || a == active_window || a->is_prompt) /* if prompt doesn't have scroll mode */
|
||||
continue;
|
||||
|
||||
line_info_print(a);
|
||||
}
|
||||
}
|
||||
|
||||
int get_num_active_windows(void)
|
||||
{
|
||||
return num_active_windows;
|
||||
|
Loading…
Reference in New Issue
Block a user