Skip to content
Snippets Groups Projects
Commit 0e335a02 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 026c7d89
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -199,6 +199,13 @@ int kbwait(void) { ...@@ -199,6 +199,13 @@ int kbwait(void) {
return(FALSE); return(FALSE);
} }
static int
dyn_kbwait(mode) {
if (mode & WIN_DYN)
return kbhit();
return kbwait();
}
int inkey(void) int inkey(void)
{ {
int c; int c;
...@@ -1102,7 +1109,7 @@ int ulist(int64_t mode, int left, int top, int width, int *cur, int *bar ...@@ -1102,7 +1109,7 @@ int ulist(int64_t mode, int left, int top, int width, int *cur, int *bar
gotkey=0; gotkey=0;
textattr(((api->lbclr)&0x0f)|((api->lbclr >> 4)&0x0f)); textattr(((api->lbclr)&0x0f)|((api->lbclr >> 4)&0x0f));
gotoxy(s_left+lbrdrwidth+2+left, s_top+y); 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) if(api->exit_flags & UIFC_XF_QUIT)
gotkey = CIO_KEY_QUIT; gotkey = CIO_KEY_QUIT;
else if(mode&WIN_POP) else if(mode&WIN_POP)
...@@ -2949,7 +2956,7 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons ...@@ -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 > textbuf ? api->chars->up_arrow : ' ');
putch(p < textend ? api->chars->down_arrow : ' '); putch(p < textend ? api->chars->down_arrow : ' ');
} }
if(kbwait()) { if(dyn_kbwait(mode)) {
j=inkey(); j=inkey();
if(j==CIO_KEY_MOUSE) { if(j==CIO_KEY_MOUSE) {
/* Ignores return value to avoid hitting help/exit hotspots */ /* 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.
Please register or to comment