From 4c7c8daf9ccea7ac6a9089be362d254771c50811 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Mon, 9 Oct 2017 02:08:36 +0100 Subject: wayland_common: implement output tracking, cleanups and bugfixes This commit: - Implements output tracking (e.g. monitor plug/unplug) - Creates the surface during registry (no other dependencies) - Queues the callback immediately after surface creation - Cleaner and better event handling (functions return directly) - Better reconfigure handling (resizes reduced to 1 during init) - Don't unnecessarily resize (if dimensions match) Apart from that fixes 2 potential memory leaks (mime type and window title), 2 string ownership issues (output name and make need to be dup'd), fixes some style issues (switches were indented) and finally adds messages when disabling/enabling idle inhibition. The callback setter function was removed in preparation for the commit which will use the frame event cb because it was unnecessary. --- video/out/wayland_common.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'video/out/wayland_common.h') diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 60d5924efa..3903b58a2b 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -25,20 +25,19 @@ #include "vo.h" #include "input/event.h" -typedef void (*vo_wayland_frame_cb)(struct vo_wayland_state *wl, void *priv, uint32_t time); - struct vo_wayland_output { + struct vo_wayland_state *wl; uint32_t id; struct wl_output *output; struct mp_rect geometry; - int width; - int height; + int phys_width; + int phys_height; int scale; uint32_t flags; double refresh_rate; - const char *make; - const char *model; - int has_surface; + char *make; + char *model; + bool has_surface; struct wl_list link; }; @@ -54,8 +53,8 @@ struct vo_wayland_state { struct mp_rect geometry; struct mp_rect window_size; float aspect_ratio; - int fullscreen; - char *window_title; + bool fullscreen; + bool configured; int wakeup_pipe[2]; int pending_vo_events; int mouse_x; @@ -64,9 +63,6 @@ struct vo_wayland_state { int touch_entries; uint32_t pointer_id; int display_fd; - int configured; - vo_wayland_frame_cb callback_exec; - void *callback_exec_priv; struct wl_callback *frame_callback; struct wl_list output_list; struct vo_wayland_output *current_output; @@ -112,6 +108,5 @@ void vo_wayland_check_events(struct vo *vo); void vo_wayland_uninit(struct vo *vo); void vo_wayland_wakeup(struct vo *vo); void vo_wayland_wait_events(struct vo *vo, int64_t until_time_us); -void vo_wayland_set_cb_exec(struct vo *vo, vo_wayland_frame_cb cb, void *cb_priv); #endif /* MPLAYER_WAYLAND_COMMON_H */ -- cgit v1.2.3