Skip to content
Snippets Groups Projects
Commit 969c3bb0 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Call kbwait() before wany uifc.list() we care about the return value of

Fixes high CPU utilization at menus.
parent b4d3dd21
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4175 failed
...@@ -2430,12 +2430,21 @@ done: ...@@ -2430,12 +2430,21 @@ done:
return ret; return ret;
} }
static void
kbwait(void)
{
for (int tc = 0; tc < 50; tc++) {
if (kbhit())
break;
SLEEP(1);
}
}
/* /*
* Displays the BBS list and allows edits to user BBS list * Displays the BBS list and allows edits to user BBS list
* Mode is one of BBSLIST_SELECT or BBSLIST_EDIT * Mode is one of BBSLIST_SELECT or BBSLIST_EDIT
*/ */
struct bbslist * struct bbslist *
show_bbslist(char *current, int connected) show_bbslist(char *current, int connected)
{ {
#define BBSLIST_SIZE ((MAX_OPTS + 1) * sizeof(struct bbslist *)) #define BBSLIST_SIZE ((MAX_OPTS + 1) * sizeof(struct bbslist *))
...@@ -2561,6 +2570,7 @@ show_bbslist(char *current, int connected) ...@@ -2561,6 +2570,7 @@ show_bbslist(char *current, int connected)
uifc.list_height = listcount + 5; uifc.list_height = listcount + 5;
if (uifc.list_height > (uifc.scrn_len - 4)) if (uifc.list_height > (uifc.scrn_len - 4))
uifc.list_height = uifc.scrn_len - 4; uifc.list_height = uifc.scrn_len - 4;
kbwait();
val = uifc.list((listcount < MAX_OPTS ? WIN_XTR : 0) val = uifc.list((listcount < MAX_OPTS ? WIN_XTR : 0)
| WIN_ACT | WIN_INSACT | WIN_DELACT | WIN_UNGETMOUSE | WIN_SAV | WIN_ESC | WIN_ACT | WIN_INSACT | WIN_DELACT | WIN_UNGETMOUSE | WIN_SAV | WIN_ESC
| WIN_INS | WIN_DEL | WIN_EDIT | WIN_EXTKEYS | WIN_DYN | WIN_FIXEDHEIGHT | WIN_INS | WIN_DEL | WIN_EDIT | WIN_EXTKEYS | WIN_DYN | WIN_FIXEDHEIGHT
...@@ -2725,6 +2735,8 @@ show_bbslist(char *current, int connected) ...@@ -2725,6 +2735,8 @@ show_bbslist(char *current, int connected)
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
return NULL; return NULL;
case -2:
kbwait();
} }
} }
else if (val & MSK_ON) { else if (val & MSK_ON) {
...@@ -2994,6 +3006,7 @@ show_bbslist(char *current, int connected) ...@@ -2994,6 +3006,7 @@ show_bbslist(char *current, int connected)
if (oldopt != -2) if (oldopt != -2)
settitle(syncterm_version); settitle(syncterm_version);
oldopt = -2; oldopt = -2;
kbwait();
val = uifc.list(WIN_T2B | WIN_RHT | WIN_EXTKEYS | WIN_DYN | WIN_UNGETMOUSE | WIN_ACT | WIN_ESC val = uifc.list(WIN_T2B | WIN_RHT | WIN_EXTKEYS | WIN_DYN | WIN_UNGETMOUSE | WIN_ACT | WIN_ESC
, ,
0, 0,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment