[client] app: allow selective full invalidation

Overlays only need to trigger a new frame if they have changed and not
full window invalidation, this change allows for this.
This commit is contained in:
Geoffrey McRae 2021-08-05 06:47:36 +10:00
parent 6c84c0eca6
commit 6e7f39edee
8 changed files with 13 additions and 12 deletions

View File

@ -123,7 +123,7 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
app_handleResizeEvent(wlWm.width, wlWm.height, wl_fixed_to_double(wlWm.scale),
(struct Border) {0, 0, 0, 0});
app_invalidateWindow();
app_invalidateWindow(true);
waylandStopWaitFrame();
wlWm.needsResize = false;
}

View File

@ -46,7 +46,7 @@ static void xdgSurfaceConfigure(void * data, struct xdg_surface * xdgSurface,
{
wlWm.needsResize = true;
wlWm.resizeSerial = serial;
app_invalidateWindow();
app_invalidateWindow(true);
waylandStopWaitFrame();
}
else

View File

@ -48,7 +48,7 @@ void waylandWindowUpdateScale(void)
wlWm.scale = maxScale;
wlWm.fractionalScale = wl_fixed_from_int(wl_fixed_to_int(maxScale)) != maxScale;
wlWm.needsResize = true;
app_invalidateWindow();
app_invalidateWindow(true);
waylandStopWaitFrame();
}
}

View File

@ -708,7 +708,7 @@ static int x11EventThread(void * unused)
case Expose:
{
app_invalidateWindow();
app_invalidateWindow(true);
break;
}

View File

@ -46,7 +46,7 @@ bool app_isFormatValid(void);
void app_updateCursorPos(double x, double y);
void app_updateWindowPos(int x, int y);
void app_handleResizeEvent(int w, int h, double scale, const struct Border border);
void app_invalidateWindow(void);
void app_invalidateWindow(bool full);
void app_handleMouseRelative(double normx, double normy,
double rawx, double rawy);

View File

@ -495,9 +495,10 @@ void app_handleResizeEvent(int w, int h, double scale, const struct Border borde
}
}
void app_invalidateWindow(void)
void app_invalidateWindow(bool full)
{
atomic_store(&g_state.invalidateWindow, true);
if (full)
atomic_store(&g_state.invalidateWindow, true);
lgSignalEvent(g_state.frameEvent);
}
@ -537,7 +538,7 @@ void app_handleRenderEvent(const uint64_t timeUs)
}
if (invalidate)
app_invalidateWindow();
app_invalidateWindow(false);
}
void app_setFullscreen(bool fs)
@ -616,7 +617,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();
app_invalidateWindow(false);
}
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description)
@ -875,7 +876,7 @@ void app_setOverlay(bool enable)
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
core_resetOverlayInputState();
core_setGrabQuiet(wasGrabbed);
app_invalidateWindow();
app_invalidateWindow(false);
}
}

View File

@ -31,7 +31,7 @@ static bool showFPS;
static void showFPSKeybind(int sc, void * opaque)
{
showFPS ^= true;
app_invalidateWindow();
app_invalidateWindow(false);
}
static void fps_earlyInit(void)

View File

@ -65,7 +65,7 @@ static void configCallback(void * udata)
static void showTimingKeybind(int sc, void * opaque)
{
gs.show ^= true;
app_invalidateWindow();
app_invalidateWindow(false);
}
static bool graphs_init(void ** udata, const void * params)