mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:21:57 +00:00
[client] wayland: implement signalNextFrame with frame callbacks
This commit is contained in:
parent
3043296e52
commit
a213ee960a
3 changed files with 21 additions and 0 deletions
|
@ -164,6 +164,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
|
||||||
.glSetSwapInterval = waylandGLSetSwapInterval,
|
.glSetSwapInterval = waylandGLSetSwapInterval,
|
||||||
.glSwapBuffers = waylandGLSwapBuffers,
|
.glSwapBuffers = waylandGLSwapBuffers,
|
||||||
#endif
|
#endif
|
||||||
|
.signalNextFrame = waylandSignalNextFrame,
|
||||||
.guestPointerUpdated = waylandGuestPointerUpdated,
|
.guestPointerUpdated = waylandGuestPointerUpdated,
|
||||||
.setPointer = waylandSetPointer,
|
.setPointer = waylandSetPointer,
|
||||||
.grabPointer = waylandGrabPointer,
|
.grabPointer = waylandGrabPointer,
|
||||||
|
|
|
@ -289,3 +289,4 @@ void waylandWindowFree(void);
|
||||||
void waylandWindowUpdateScale(void);
|
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 waylandSignalNextFrame(LGEvent * event);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/event.h"
|
||||||
|
|
||||||
// Surface-handling listeners.
|
// Surface-handling listeners.
|
||||||
|
|
||||||
|
@ -114,3 +115,21 @@ bool waylandIsValidPointerPos(int x, int y)
|
||||||
{
|
{
|
||||||
return x >= 0 && x < wlWm.width && y >= 0 && y < wlWm.height;
|
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 a new issue