mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
wayland: reorganize wayland common code
Mostly a cosmetic change that (hopefully) makes things look better. Some functions and structs that were previously being exported in the wayland header were made static to the wayland_common.c file (these shouldn't be accessed by anyone else).
This commit is contained in:
parent
76a53f9de3
commit
488581912d
@ -81,7 +81,7 @@ static void wayland_egl_swap_buffers(struct ra_swapchain *sw)
|
|||||||
vo_wayland_wait_frame(wl);
|
vo_wayland_wait_frame(wl);
|
||||||
|
|
||||||
if (wl->presentation)
|
if (wl->presentation)
|
||||||
wayland_sync_swap(wl);
|
vo_wayland_sync_swap(wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct ra_swapchain_fns wayland_egl_swapchain = {
|
static const struct ra_swapchain_fns wayland_egl_swapchain = {
|
||||||
|
@ -278,7 +278,7 @@ static void flip_page(struct vo *vo)
|
|||||||
vo_wayland_wait_frame(wl);
|
vo_wayland_wait_frame(wl);
|
||||||
|
|
||||||
if (wl->presentation)
|
if (wl->presentation)
|
||||||
wayland_sync_swap(wl);
|
vo_wayland_sync_swap(wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
|
static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
|
||||||
|
@ -46,7 +46,7 @@ static void wayland_vk_swap_buffers(struct ra_ctx *ctx)
|
|||||||
vo_wayland_wait_frame(wl);
|
vo_wayland_wait_frame(wl);
|
||||||
|
|
||||||
if (wl->presentation)
|
if (wl->presentation)
|
||||||
wayland_sync_swap(wl);
|
vo_wayland_sync_swap(wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wayland_vk_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info)
|
static void wayland_vk_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,11 +19,8 @@
|
|||||||
#define MPLAYER_WAYLAND_COMMON_H
|
#define MPLAYER_WAYLAND_COMMON_H
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <wayland-cursor.h>
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
|
||||||
|
|
||||||
#include "vo.h"
|
|
||||||
#include "input/event.h"
|
#include "input/event.h"
|
||||||
|
#include "vo.h"
|
||||||
|
|
||||||
struct wayland_opts {
|
struct wayland_opts {
|
||||||
int disable_vsync;
|
int disable_vsync;
|
||||||
@ -31,85 +28,66 @@ struct wayland_opts {
|
|||||||
int edge_pixels_touch;
|
int edge_pixels_touch;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vo_wayland_sync {
|
|
||||||
int64_t ust;
|
|
||||||
int64_t msc;
|
|
||||||
int64_t sbc;
|
|
||||||
bool filled;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vo_wayland_output {
|
|
||||||
struct vo_wayland_state *wl;
|
|
||||||
uint32_t id;
|
|
||||||
struct wl_output *output;
|
|
||||||
struct mp_rect geometry;
|
|
||||||
int phys_width;
|
|
||||||
int phys_height;
|
|
||||||
int scale;
|
|
||||||
uint32_t flags;
|
|
||||||
double refresh_rate;
|
|
||||||
char *make;
|
|
||||||
char *model;
|
|
||||||
bool has_surface;
|
|
||||||
struct wl_list link;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vo_wayland_state {
|
struct vo_wayland_state {
|
||||||
struct mp_log *log;
|
|
||||||
struct vo *vo;
|
|
||||||
struct wl_display *display;
|
|
||||||
struct wl_shm *shm;
|
|
||||||
struct wl_compositor *compositor;
|
|
||||||
struct wl_registry *registry;
|
|
||||||
struct wayland_opts *opts;
|
|
||||||
|
|
||||||
struct m_config_cache *vo_opts_cache;
|
struct m_config_cache *vo_opts_cache;
|
||||||
struct mp_vo_opts *vo_opts;
|
struct mp_log *log;
|
||||||
|
struct mp_vo_opts *vo_opts;
|
||||||
|
struct vo *vo;
|
||||||
|
struct wayland_opts *opts;
|
||||||
|
struct wl_callback *frame_callback;
|
||||||
|
struct wl_compositor *compositor;
|
||||||
|
struct wl_display *display;
|
||||||
|
struct wl_registry *registry;
|
||||||
|
struct wl_shm *shm;
|
||||||
|
struct wl_surface *surface;
|
||||||
|
|
||||||
|
/* Geometry */
|
||||||
|
struct mp_rect geometry;
|
||||||
|
struct mp_rect vdparams;
|
||||||
|
struct mp_rect window_size;
|
||||||
|
struct wl_list output_list;
|
||||||
|
struct vo_wayland_output *current_output;
|
||||||
|
int gcd;
|
||||||
|
int reduced_height;
|
||||||
|
int reduced_width;
|
||||||
|
int toplevel_width;
|
||||||
|
int toplevel_height;
|
||||||
|
|
||||||
/* State */
|
/* State */
|
||||||
struct mp_rect geometry;
|
bool activated;
|
||||||
struct mp_rect window_size;
|
bool has_keyboard_input;
|
||||||
struct mp_rect vdparams;
|
bool focused;
|
||||||
int gcd;
|
|
||||||
int reduced_width;
|
|
||||||
int reduced_height;
|
|
||||||
bool frame_wait;
|
bool frame_wait;
|
||||||
bool render;
|
bool render;
|
||||||
bool state_change;
|
bool state_change;
|
||||||
bool toplevel_configured;
|
bool toplevel_configured;
|
||||||
bool activated;
|
int display_fd;
|
||||||
bool has_keyboard_input;
|
|
||||||
bool focused;
|
|
||||||
int timeout_count;
|
|
||||||
int wakeup_pipe[2];
|
|
||||||
int pending_vo_events;
|
|
||||||
int mouse_x;
|
|
||||||
int mouse_y;
|
|
||||||
int mouse_unscaled_x;
|
int mouse_unscaled_x;
|
||||||
int mouse_unscaled_y;
|
int mouse_unscaled_y;
|
||||||
|
int mouse_x;
|
||||||
|
int mouse_y;
|
||||||
|
int pending_vo_events;
|
||||||
int scaling;
|
int scaling;
|
||||||
|
int timeout_count;
|
||||||
int touch_entries;
|
int touch_entries;
|
||||||
int toplevel_width;
|
int wakeup_pipe[2];
|
||||||
int toplevel_height;
|
|
||||||
uint32_t pointer_id;
|
|
||||||
int display_fd;
|
|
||||||
struct wl_callback *frame_callback;
|
|
||||||
struct wl_list output_list;
|
|
||||||
struct vo_wayland_output *current_output;
|
|
||||||
|
|
||||||
/* Shell */
|
/* idle-inhibit */
|
||||||
struct wl_surface *surface;
|
|
||||||
struct xdg_wm_base *wm_base;
|
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
|
||||||
struct xdg_surface *xdg_surface;
|
|
||||||
struct wp_presentation *presentation;
|
|
||||||
struct wp_presentation_feedback *feedback;
|
|
||||||
struct zxdg_decoration_manager_v1 *xdg_decoration_manager;
|
|
||||||
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
|
||||||
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
|
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
|
||||||
struct zwp_idle_inhibitor_v1 *idle_inhibitor;
|
struct zwp_idle_inhibitor_v1 *idle_inhibitor;
|
||||||
|
|
||||||
/* Presentation Feedback */
|
/* xdg-decoration */
|
||||||
|
struct zxdg_decoration_manager_v1 *xdg_decoration_manager;
|
||||||
|
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
||||||
|
|
||||||
|
/* xdg-shell */
|
||||||
|
struct xdg_wm_base *wm_base;
|
||||||
|
struct xdg_surface *xdg_surface;
|
||||||
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
|
|
||||||
|
/* presentation-time */
|
||||||
|
struct wp_presentation *presentation;
|
||||||
|
struct wp_presentation_feedback *feedback;
|
||||||
struct vo_wayland_sync *sync;
|
struct vo_wayland_sync *sync;
|
||||||
int sync_size;
|
int sync_size;
|
||||||
int64_t last_ust;
|
int64_t last_ust;
|
||||||
@ -120,43 +98,42 @@ struct vo_wayland_state {
|
|||||||
int64_t vsync_duration;
|
int64_t vsync_duration;
|
||||||
|
|
||||||
/* Input */
|
/* Input */
|
||||||
uint32_t keyboard_code;
|
|
||||||
struct wl_seat *seat;
|
|
||||||
struct wl_pointer *pointer;
|
|
||||||
struct wl_touch *touch;
|
|
||||||
struct wl_keyboard *keyboard;
|
struct wl_keyboard *keyboard;
|
||||||
|
struct wl_pointer *pointer;
|
||||||
|
struct wl_seat *seat;
|
||||||
|
struct wl_touch *touch;
|
||||||
struct xkb_context *xkb_context;
|
struct xkb_context *xkb_context;
|
||||||
struct xkb_keymap *xkb_keymap;
|
struct xkb_keymap *xkb_keymap;
|
||||||
struct xkb_state *xkb_state;
|
struct xkb_state *xkb_state;
|
||||||
|
uint32_t keyboard_code;
|
||||||
|
|
||||||
/* DND */
|
/* DND */
|
||||||
struct wl_data_device_manager *dnd_devman;
|
|
||||||
struct wl_data_device *dnd_ddev;
|
struct wl_data_device *dnd_ddev;
|
||||||
|
struct wl_data_device_manager *dnd_devman;
|
||||||
struct wl_data_offer *dnd_offer;
|
struct wl_data_offer *dnd_offer;
|
||||||
enum mp_dnd_action dnd_action;
|
enum mp_dnd_action dnd_action;
|
||||||
char *dnd_mime_type;
|
char *dnd_mime_type;
|
||||||
int dnd_mime_score;
|
|
||||||
int dnd_fd;
|
int dnd_fd;
|
||||||
|
int dnd_mime_score;
|
||||||
|
|
||||||
/* Cursor */
|
/* Cursor */
|
||||||
struct wl_cursor_theme *cursor_theme;
|
struct wl_cursor_theme *cursor_theme;
|
||||||
struct wl_cursor *default_cursor;
|
struct wl_cursor *default_cursor;
|
||||||
struct wl_surface *cursor_surface;
|
struct wl_surface *cursor_surface;
|
||||||
int allocated_cursor_scale;
|
|
||||||
bool cursor_visible;
|
bool cursor_visible;
|
||||||
|
int allocated_cursor_scale;
|
||||||
|
uint32_t pointer_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int vo_wayland_control(struct vo *vo, int *events, int request, void *arg);
|
||||||
int vo_wayland_init(struct vo *vo);
|
int vo_wayland_init(struct vo *vo);
|
||||||
int vo_wayland_reconfig(struct vo *vo);
|
int vo_wayland_reconfig(struct vo *vo);
|
||||||
int vo_wayland_control(struct vo *vo, int *events, int request, void *arg);
|
|
||||||
int last_available_sync(struct vo_wayland_state *wl);
|
void vo_wayland_set_opaque_region(struct vo_wayland_state *wl, int alpha);
|
||||||
|
void vo_wayland_sync_swap(struct vo_wayland_state *wl);
|
||||||
void vo_wayland_uninit(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_wait_events(struct vo *vo, int64_t until_time_us);
|
||||||
void vo_wayland_wait_frame(struct vo_wayland_state *wl);
|
void vo_wayland_wait_frame(struct vo_wayland_state *wl);
|
||||||
void vo_wayland_set_opaque_region(struct vo_wayland_state *wl, int alpha);
|
void vo_wayland_wakeup(struct vo *vo);
|
||||||
void wayland_sync_swap(struct vo_wayland_state *wl);
|
|
||||||
void vo_wayland_sync_shift(struct vo_wayland_state *wl);
|
|
||||||
void queue_new_sync(struct vo_wayland_state *wl);
|
|
||||||
|
|
||||||
#endif /* MPLAYER_WAYLAND_COMMON_H */
|
#endif /* MPLAYER_WAYLAND_COMMON_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user