[client] wayland: make waitFrame work when not rendering

Implement skipFrame and do various things to wake waitFrame.
This commit is contained in:
Quantum 2021-08-01 04:06:35 -04:00 committed by Geoffrey McRae
parent 16aa04d539
commit 2e4614cbc4
5 changed files with 16 additions and 0 deletions

View File

@ -70,6 +70,7 @@ static void libdecorFrameConfigure(struct libdecor_frame * frame,
wlWm.needsResize = true; wlWm.needsResize = true;
wlWm.resizeSerial = configuration->serial; wlWm.resizeSerial = configuration->serial;
app_invalidateWindow(); app_invalidateWindow();
waylandForceRender();
} }
else else
wlWm.configured = true; wlWm.configured = true;

View File

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

View File

@ -173,6 +173,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
.glSwapBuffers = waylandGLSwapBuffers, .glSwapBuffers = waylandGLSwapBuffers,
#endif #endif
.waitFrame = waylandWaitFrame, .waitFrame = waylandWaitFrame,
.skipFrame = waylandSkipFrame,
.guestPointerUpdated = waylandGuestPointerUpdated, .guestPointerUpdated = waylandGuestPointerUpdated,
.setPointer = waylandSetPointer, .setPointer = waylandSetPointer,
.grabPointer = waylandGrabPointer, .grabPointer = waylandGrabPointer,

View File

@ -307,3 +307,5 @@ void waylandWindowUpdateScale(void);
void waylandSetWindowSize(int x, int y); void waylandSetWindowSize(int x, int y);
bool waylandIsValidPointerPos(int x, int y); bool waylandIsValidPointerPos(int x, int y);
void waylandWaitFrame(void); void waylandWaitFrame(void);
void waylandSkipFrame(void);
void waylandForceRender(void);

View File

@ -144,3 +144,14 @@ void waylandWaitFrame(void)
if (callback) if (callback)
wl_callback_add_listener(callback, &frame_listener, NULL); wl_callback_add_listener(callback, &frame_listener, NULL);
} }
void waylandSkipFrame(void)
{
// If we decided to not render, we must commit the surface so that the callback is registered.
wl_surface_commit(wlWm.surface);
}
void waylandForceRender(void)
{
lgSignalEvent(wlWm.frameEvent);
}