diff --git a/client/src/app.c b/client/src/app.c index 2445249f..e3dc60f5 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -509,11 +509,13 @@ void app_handleCloseEvent(void) void app_handleRenderEvent(const uint64_t timeUs) { + bool invalidate = false; if (!g_state.escapeActive) { if (g_state.escapeHelp) { g_state.escapeHelp = false; + invalidate = true; } } else @@ -521,8 +523,21 @@ void app_handleRenderEvent(const uint64_t timeUs) if (!g_state.escapeHelp && timeUs - g_state.escapeTime > g_params.helpMenuDelayUs) { g_state.escapeHelp = true; + invalidate = true; } } + + if (g_state.alertShow) + if (g_state.alertTimeout < timeUs) + { + g_state.alertShow = false; + free(g_state.alertMessage); + g_state.alertMessage = NULL; + invalidate = true; + } + + if (invalidate) + app_invalidateWindow(); } void app_setFullscreen(bool fs) @@ -601,6 +616,7 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...) g_state.alertTimeout = microtime() + ALERT_TIMEOUT; g_state.alertType = type; g_state.alertShow = true; + app_invalidateWindow(); } KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description) diff --git a/client/src/keybind.c b/client/src/keybind.c index 282d47bc..9f4f66dc 100644 --- a/client/src/keybind.c +++ b/client/src/keybind.c @@ -51,11 +51,13 @@ static void bind_video(int sc, void * opaque) static void bind_showFPS(int sc, void * opaque) { g_state.showFPS = !g_state.showFPS; + app_invalidateWindow(); } static void bind_showTiming(int sc, void * opaque) { g_state.showTiming = !g_state.showTiming; + app_invalidateWindow(); } static void bind_rotate(int sc, void * opaque) diff --git a/client/src/main.c b/client/src/main.c index 93799c78..c72f71d4 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -167,6 +167,7 @@ static int renderThread(void * unused) while(g_state.state != APP_STATE_SHUTDOWN) { + app_handleRenderEvent(microtime()); if (g_state.jitRender) { g_state.ds->waitFrame(); @@ -255,8 +256,6 @@ static int renderThread(void * unused) } g_state.resizeDone = true; } - - app_handleRenderEvent(now); } g_state.state = APP_STATE_SHUTDOWN; diff --git a/client/src/overlay/alert.c b/client/src/overlay/alert.c index c6532407..5566454f 100644 --- a/client/src/overlay/alert.c +++ b/client/src/overlay/alert.c @@ -47,14 +47,6 @@ static int alert_render(void * udata, bool interactive, struct Rect * windowRect if (!g_state.alertShow) return 0; - if (g_state.alertTimeout < microtime()) - { - g_state.alertShow = false; - free(g_state.alertMessage); - g_state.alertMessage = NULL; - return 0; - } - ImVec2 * screen = overlayGetScreenSize(); igSetNextWindowBgAlpha(0.8f); igSetNextWindowPos((ImVec2) { screen->x / 2.0f, screen->y / 2.0f }, 0,