diff options
Diffstat (limited to 'sway/desktop/surface.c')
-rw-r--r-- | sway/desktop/surface.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c index 41d4ce3f..853c403d 100644 --- a/sway/desktop/surface.c +++ b/sway/desktop/surface.c @@ -1,4 +1,6 @@ +#define _POSIX_C_SOURCE 200112L #include <stdlib.h> +#include <time.h> #include <wlr/types/wlr_surface.h> #include "sway/server.h" #include "sway/surface.h" @@ -9,9 +11,21 @@ void handle_destroy(struct wl_listener *listener, void *data) { surface->wlr_surface->data = NULL; wl_list_remove(&surface->destroy.link); + wl_event_source_remove(surface->frame_done_timer); + free(surface); } +static int surface_frame_done_timer_handler(void *data) { + struct sway_surface *surface = data; + + struct timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + wlr_surface_send_frame_done(surface->wlr_surface, &now); + + return 0; +} + void handle_compositor_new_surface(struct wl_listener *listener, void *data) { struct wlr_surface *wlr_surface = data; @@ -21,4 +35,7 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) { surface->destroy.notify = handle_destroy; wl_signal_add(&wlr_surface->events.destroy, &surface->destroy); + + surface->frame_done_timer = wl_event_loop_add_timer(server.wl_event_loop, + surface_frame_done_timer_handler, surface); } |