summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 224a60d1e0..5ddd1ad54c 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -59,6 +59,8 @@ static void schedule_resize(struct vo_wayland_state *wl,
static void vo_wayland_fullscreen (struct vo *vo);
+static const struct wl_callback_listener frame_listener;
+
static const struct mp_keymap keymap[] = {
// special keys
{XKB_KEY_Pause, MP_KEY_PAUSE}, {XKB_KEY_Escape, MP_KEY_ESC},
@@ -795,6 +797,30 @@ static void schedule_resize(struct vo_wayland_state *wl,
wl->vo->dheight = height;
}
+static void frame_callback(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+ struct vo_wayland_state *wl = data;
+
+ if (callback)
+ wl_callback_destroy(callback);
+
+ wl->frame.callback = wl_surface_frame(wl->window.video_surface);
+
+ if (!wl->frame.callback) {
+ MP_ERR(wl, "wl_surface_frame failed\n");
+ return;
+ }
+
+ wl_callback_add_listener(wl->frame.callback, &frame_listener, wl);
+ wl->frame.pending = true;
+}
+
+static const struct wl_callback_listener frame_listener = {
+ frame_callback
+};
+
static bool create_display (struct vo_wayland_state *wl)
{
if (wl->vo->probing && !getenv("XDG_RUNTIME_DIR"))
@@ -878,6 +904,7 @@ static bool create_window (struct vo_wayland_state *wl)
wl_shell_surface_set_class(wl->window.shell_surface, "mpv");
}
+ frame_callback(wl, NULL, 0);
return true;
}
@@ -888,6 +915,9 @@ static void destroy_window (struct vo_wayland_state *wl)
if (wl->window.video_surface)
wl_surface_destroy(wl->window.video_surface);
+
+ if (wl->frame.callback)
+ wl_callback_destroy(wl->frame.callback);
}
static bool create_cursor (struct vo_wayland_state *wl)