aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/surface.c
diff options
context:
space:
mode:
authorLibravatar Ivan Molodetskikh <yalterz@gmail.com>2019-09-25 17:35:41 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2019-11-17 20:18:42 +0100
commitbd9a53f1a3e7dba247aab0a4e4268724acc12c38 (patch)
tree1547b79a82b1c4e22512d0262cbb133a14ef10a3 /sway/desktop/surface.c
parentAdd sway_surface (diff)
downloadsway-bd9a53f1a3e7dba247aab0a4e4268724acc12c38.tar.gz
sway-bd9a53f1a3e7dba247aab0a4e4268724acc12c38.tar.zst
sway-bd9a53f1a3e7dba247aab0a4e4268724acc12c38.zip
view: add max_render_time
Diffstat (limited to 'sway/desktop/surface.c')
-rw-r--r--sway/desktop/surface.c17
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 @@
1#define _POSIX_C_SOURCE 200112L
1#include <stdlib.h> 2#include <stdlib.h>
3#include <time.h>
2#include <wlr/types/wlr_surface.h> 4#include <wlr/types/wlr_surface.h>
3#include "sway/server.h" 5#include "sway/server.h"
4#include "sway/surface.h" 6#include "sway/surface.h"
@@ -9,9 +11,21 @@ void handle_destroy(struct wl_listener *listener, void *data) {
9 surface->wlr_surface->data = NULL; 11 surface->wlr_surface->data = NULL;
10 wl_list_remove(&surface->destroy.link); 12 wl_list_remove(&surface->destroy.link);
11 13
14 wl_event_source_remove(surface->frame_done_timer);
15
12 free(surface); 16 free(surface);
13} 17}
14 18
19static int surface_frame_done_timer_handler(void *data) {
20 struct sway_surface *surface = data;
21
22 struct timespec now;
23 clock_gettime(CLOCK_MONOTONIC, &now);
24 wlr_surface_send_frame_done(surface->wlr_surface, &now);
25
26 return 0;
27}
28
15void handle_compositor_new_surface(struct wl_listener *listener, void *data) { 29void handle_compositor_new_surface(struct wl_listener *listener, void *data) {
16 struct wlr_surface *wlr_surface = data; 30 struct wlr_surface *wlr_surface = data;
17 31
@@ -21,4 +35,7 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) {
21 35
22 surface->destroy.notify = handle_destroy; 36 surface->destroy.notify = handle_destroy;
23 wl_signal_add(&wlr_surface->events.destroy, &surface->destroy); 37 wl_signal_add(&wlr_surface->events.destroy, &surface->destroy);
38
39 surface->frame_done_timer = wl_event_loop_add_timer(server.wl_event_loop,
40 surface_frame_done_timer_handler, surface);
24} 41}