shaders using wayland time instead of stdtime

This commit is contained in:
Rakarake 2026-02-07 16:20:19 +01:00
parent bb63b49155
commit 859025a4a3
3 changed files with 14 additions and 31 deletions

View file

@ -16,6 +16,7 @@ struct surface {
/// Wating to be redrawn.
bool dirty;
uint32_t time;
struct wl_surface *wl_surface;
struct xdg_surface *xdg_surface;
@ -25,9 +26,6 @@ struct surface {
struct wl_output *wl_output;
EGLSurface egl_surface;
/// We need a back-pointer for callbacks.
struct client_state *state;
};
struct surface_list {
@ -156,7 +154,7 @@ static const struct wl_callback_listener wl_surface_frame_listener;
static void
wl_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) {
struct surface *surface = data;
struct client_state *state = surface->state;
surface->time = time;
/* Destroy this callback */
wl_callback_destroy(cb);
@ -455,7 +453,8 @@ static void egl_init(struct client_state *state) {
}
/// Initializes wayland and creates an opengl context
void wayland_init(struct client_state *state, int output_type) {
struct client_state* wayland_init(int output_type) {
struct client_state *state = malloc(sizeof(struct client_state));
state->running = 1;
state->output_type = output_type;
state->wl_display = wl_display_connect(NULL);
@ -474,6 +473,7 @@ void wayland_init(struct client_state *state, int output_type) {
}
egl_init(state);
return state;
}
struct event wait_for_event(struct client_state *state) {
@ -507,6 +507,7 @@ struct event wait_for_event(struct client_state *state) {
.draw = {
.width = next->data.width,
.height = next->data.height,
.time = next->data.time,
.surface = &next->data,
}
}