mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[client] wayland: implement signalNextFrame with frame callbacks
This commit is contained in:
parent
3043296e52
commit
a213ee960a
@ -164,6 +164,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
|
||||
.glSetSwapInterval = waylandGLSetSwapInterval,
|
||||
.glSwapBuffers = waylandGLSwapBuffers,
|
||||
#endif
|
||||
.signalNextFrame = waylandSignalNextFrame,
|
||||
.guestPointerUpdated = waylandGuestPointerUpdated,
|
||||
.setPointer = waylandSetPointer,
|
||||
.grabPointer = waylandGrabPointer,
|
||||
|
@ -289,3 +289,4 @@ void waylandWindowFree(void);
|
||||
void waylandWindowUpdateScale(void);
|
||||
void waylandSetWindowSize(int x, int y);
|
||||
bool waylandIsValidPointerPos(int x, int y);
|
||||
void waylandSignalNextFrame(LGEvent * event);
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "app.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/event.h"
|
||||
|
||||
// Surface-handling listeners.
|
||||
|
||||
@ -114,3 +115,21 @@ bool waylandIsValidPointerPos(int x, int y)
|
||||
{
|
||||
return x >= 0 && x < wlWm.width && y >= 0 && y < wlWm.height;
|
||||
}
|
||||
|
||||
static void frameHandler(void * opaque, struct wl_callback * callback, unsigned int data)
|
||||
{
|
||||
LGEvent * event = opaque;
|
||||
lgSignalEvent(event);
|
||||
wl_callback_destroy(callback);
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener frame_listener = {
|
||||
.done = frameHandler,
|
||||
};
|
||||
|
||||
void waylandSignalNextFrame(LGEvent * event)
|
||||
{
|
||||
struct wl_callback * callback = wl_surface_frame(wlWm.surface);
|
||||
if (callback)
|
||||
wl_callback_add_listener(callback, &frame_listener, event);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user