mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-29 14:56:44 +02:00
Greatly reduce redundant window refreshing
This should substantially reduce CPU usage and possibly fix some issues with interface jittering/flashing
This commit is contained in:
13
src/chat.c
13
src/chat.c
@ -1072,13 +1072,12 @@ static void draw_infobox(ToxWindow *self)
|
||||
|
||||
time_t curtime = get_unix_time();
|
||||
|
||||
/* update elapsed time string once per second */
|
||||
if (curtime > infobox->lastupdate) {
|
||||
/* update interface once per second */
|
||||
if (timed_out(infobox->lastupdate, 1)) {
|
||||
get_elapsed_time_str(infobox->timestr, sizeof(infobox->timestr), curtime - infobox->starttime);
|
||||
infobox->lastupdate = curtime;
|
||||
}
|
||||
|
||||
infobox->lastupdate = curtime;
|
||||
|
||||
const char *in_is_muted = infobox->in_is_muted ? "yes" : "no";
|
||||
const char *out_is_muted = infobox->out_is_muted ? "yes" : "no";
|
||||
|
||||
@ -1443,7 +1442,11 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
refresh_file_transfer_progress(self, self->num);
|
||||
|
||||
if (refresh_file_transfer_progress(self, self->num)) {
|
||||
flag_interface_refresh();
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user