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

Avoid delay waiting for key in WIN_DYN mode

When running Windows 11 in a VirtualBox VM, Sleep(1) appears to take
much more than 1ms to return.  This causes large delays drawing menus
using WIN_DYN (as SyncTERM does).

If WIN_DYN is set, just use kbhit() with no delay.  Leave the delay
there for !WIN_DYN though.

This should generally speed up SyncTERM menu navigation as there
was a 50ms delay for each menu on the screen.
parent 2a204230
No related branches found
No related tags found
No related merge requests found
......@@ -199,6 +199,13 @@ int kbwait(void) {
return(FALSE);
}
static int
dyn_kbwait(mode) {
if (mode & WIN_DYN)
return kbhit();
return kbwait();
}
int inkey(void)
{
int c;
......@@ -1102,7 +1109,7 @@ int ulist(int64_t mode, int left, int top, int width, int *cur, int *bar
gotkey=0;
textattr(((api->lbclr)&0x0f)|((api->lbclr >> 4)&0x0f));
gotoxy(s_left+lbrdrwidth+2+left, s_top+y);
if((api->exit_flags & UIFC_XF_QUIT) || kbwait() || (mode&(WIN_POP|WIN_SEL))) {
if((api->exit_flags & UIFC_XF_QUIT) || dyn_kbwait(mode) || (mode&(WIN_POP|WIN_SEL))) {
if(api->exit_flags & UIFC_XF_QUIT)
gotkey = CIO_KEY_QUIT;
else if(mode&WIN_POP)
......@@ -2949,7 +2956,7 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons
putch(p > textbuf ? api->chars->up_arrow : ' ');
putch(p < textend ? api->chars->down_arrow : ' ');
}
if(kbwait()) {
if(dyn_kbwait(mode)) {
j=inkey();
if(j==CIO_KEY_MOUSE) {
/* Ignores return value to avoid hitting help/exit hotspots */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment