mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +00:00
[client] main: alerts and overlay toggles should invalidate the window
This commit is contained in:
parent
17687fdea3
commit
2d74c93232
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user