mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] app: delay showing the escape help for 250ms
This change prevents the help text being shown unless the escape key has been held for a minimum of 250ms (reduced from 500ms).
This commit is contained in:
parent
521ac706c1
commit
f3b46e6d4f
@ -54,6 +54,7 @@ void app_handleKeyRelease(int scancode);
|
||||
void app_handleEnterEvent(bool entered);
|
||||
void app_handleFocusEvent(bool focused);
|
||||
void app_handleCloseEvent(void);
|
||||
void app_handleRenderEvent(const uint64_t timeUs);
|
||||
|
||||
void app_setFullscreen(bool fs);
|
||||
bool app_getFullscreen(void);
|
||||
|
@ -196,7 +196,6 @@ void app_handleKeyPress(int sc)
|
||||
g_state.escapeActive = true;
|
||||
g_state.escapeTime = microtime();
|
||||
g_state.escapeAction = -1;
|
||||
app_showHelp(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -234,7 +233,7 @@ void app_handleKeyRelease(int sc)
|
||||
{
|
||||
if (g_state.escapeAction == -1)
|
||||
{
|
||||
if (microtime() - g_state.escapeTime < 500000 && g_params.useSpiceInput)
|
||||
if (!g_state.escapeHelp && g_params.useSpiceInput)
|
||||
core_setGrab(!g_cursor.grab);
|
||||
}
|
||||
else
|
||||
@ -248,10 +247,7 @@ void app_handleKeyRelease(int sc)
|
||||
}
|
||||
|
||||
if (sc == g_params.escapeKey)
|
||||
{
|
||||
g_state.escapeActive = false;
|
||||
app_showHelp(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!core_inputEnabled())
|
||||
@ -386,6 +382,26 @@ void app_handleCloseEvent(void)
|
||||
g_state.state = APP_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
void app_handleRenderEvent(const uint64_t timeUs)
|
||||
{
|
||||
if (!g_state.escapeActive)
|
||||
{
|
||||
if (g_state.escapeHelp)
|
||||
{
|
||||
g_state.escapeHelp = false;
|
||||
app_showHelp(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_state.escapeHelp && timeUs - g_state.escapeTime > 200000)
|
||||
{
|
||||
g_state.escapeHelp = true;
|
||||
app_showHelp(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void app_setFullscreen(bool fs)
|
||||
{
|
||||
g_state.ds->setFullscreen(fs);
|
||||
|
@ -157,7 +157,8 @@ static int renderThread(void * unused)
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_state.resizeDone && g_state.resizeTimeout < microtime())
|
||||
const uint64_t now = microtime();
|
||||
if (!g_state.resizeDone && g_state.resizeTimeout < now)
|
||||
{
|
||||
g_state.ds->setWindowSize(
|
||||
g_state.dstRect.w,
|
||||
@ -165,6 +166,8 @@ static int renderThread(void * unused)
|
||||
);
|
||||
g_state.resizeDone = true;
|
||||
}
|
||||
|
||||
app_handleRenderEvent(now);
|
||||
}
|
||||
|
||||
g_state.state = APP_STATE_SHUTDOWN;
|
||||
|
@ -51,6 +51,7 @@ struct AppState
|
||||
bool escapeActive;
|
||||
uint64_t escapeTime;
|
||||
int escapeAction;
|
||||
bool escapeHelp;
|
||||
KeybindHandle bindings[KEY_MAX];
|
||||
const char * keyDescription[KEY_MAX];
|
||||
bool keyDown[KEY_MAX];
|
||||
|
Loading…
Reference in New Issue
Block a user